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)
| 1706 | |
| 1707 | |
| 1708 | def CheckVlogArguments(filename, clean_lines, linenum, error): |
| 1709 | """Checks that VLOG() is only used for defining a logging level. |
| 1710 | |
| 1711 | For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and |
| 1712 | VLOG(FATAL) are not. |
| 1713 | |
| 1714 | Args: |
| 1715 | filename: The name of the current file. |
| 1716 | clean_lines: A CleansedLines instance containing the file. |
| 1717 | linenum: The number of the line to check. |
| 1718 | error: The function to call with any errors found. |
| 1719 | """ |
| 1720 | line = clean_lines.elided[linenum] |
| 1721 | if Search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line): |
| 1722 | error(filename, linenum, 'runtime/vlog', 5, |
| 1723 | 'VLOG() should be used with numeric verbosity level. ' |
| 1724 | 'Use LOG() if you want symbolic severity levels.') |
| 1725 | |
| 1726 | |
| 1727 | # Matches invalid increment: *count++, which moves pointer instead of |
no test coverage detected