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)
| 1935 | |
| 1936 | |
| 1937 | def CheckVlogArguments(filename, clean_lines, linenum, error): |
| 1938 | """Checks that VLOG() is only used for defining a logging level. |
| 1939 | |
| 1940 | For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and |
| 1941 | VLOG(FATAL) are not. |
| 1942 | |
| 1943 | Args: |
| 1944 | filename: The name of the current file. |
| 1945 | clean_lines: A CleansedLines instance containing the file. |
| 1946 | linenum: The number of the line to check. |
| 1947 | error: The function to call with any errors found. |
| 1948 | """ |
| 1949 | line = clean_lines.elided[linenum] |
| 1950 | if Search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line): |
| 1951 | error(filename, linenum, 'runtime/vlog', 5, |
| 1952 | 'VLOG() should be used with numeric verbosity level. ' |
| 1953 | 'Use LOG() if you want symbolic severity levels.') |
| 1954 | |
| 1955 | # Matches invalid increment: *count++, which moves pointer instead of |
| 1956 | # incrementing a value. |
no test coverage detected