Checks that VLOG() is only used for defining a logging level. For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and VLOG(FATAL) are not. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The nu
(filename, clean_lines, linenum, error)
| 2148 | |
| 2149 | |
| 2150 | def CheckVlogArguments(filename, clean_lines, linenum, error): |
| 2151 | """Checks that VLOG() is only used for defining a logging level. |
| 2152 | |
| 2153 | For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and |
| 2154 | VLOG(FATAL) are not. |
| 2155 | |
| 2156 | Args: |
| 2157 | filename: The name of the current file. |
| 2158 | clean_lines: A CleansedLines instance containing the file. |
| 2159 | linenum: The number of the line to check. |
| 2160 | error: The function to call with any errors found. |
| 2161 | """ |
| 2162 | line = clean_lines.elided[linenum] |
| 2163 | if Search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line): |
| 2164 | error(filename, linenum, 'runtime/vlog', 5, |
| 2165 | 'VLOG() should be used with numeric verbosity level. ' |
| 2166 | 'Use LOG() if you want symbolic severity levels.') |
| 2167 | |
| 2168 | # Matches invalid increment: *count++, which moves pointer instead of |
| 2169 | # incrementing a value. |
no test coverage detected