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)
| 2634 | |
| 2635 | |
| 2636 | def CheckVlogArguments(filename, clean_lines, linenum, error): |
| 2637 | """Checks that VLOG() is only used for defining a logging level. |
| 2638 | |
| 2639 | For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and |
| 2640 | VLOG(FATAL) are not. |
| 2641 | |
| 2642 | Args: |
| 2643 | filename: The name of the current file. |
| 2644 | clean_lines: A CleansedLines instance containing the file. |
| 2645 | linenum: The number of the line to check. |
| 2646 | error: The function to call with any errors found. |
| 2647 | """ |
| 2648 | line = clean_lines.elided[linenum] |
| 2649 | if Search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line): |
| 2650 | error(filename, linenum, 'runtime/vlog', 5, |
| 2651 | 'VLOG() should be used with numeric verbosity level. ' |
| 2652 | 'Use LOG() if you want symbolic severity levels.') |
| 2653 | |
| 2654 | # Matches invalid increment: *count++, which moves pointer instead of |
| 2655 | # incrementing a value. |