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)
| 2648 | |
| 2649 | |
| 2650 | def CheckVlogArguments(filename, clean_lines, linenum, error): |
| 2651 | """Checks that VLOG() is only used for defining a logging level. |
| 2652 | |
| 2653 | For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and |
| 2654 | VLOG(FATAL) are not. |
| 2655 | |
| 2656 | Args: |
| 2657 | filename: The name of the current file. |
| 2658 | clean_lines: A CleansedLines instance containing the file. |
| 2659 | linenum: The number of the line to check. |
| 2660 | error: The function to call with any errors found. |
| 2661 | """ |
| 2662 | line = clean_lines.elided[linenum] |
| 2663 | if Search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line): |
| 2664 | error(filename, linenum, 'runtime/vlog', 5, |
| 2665 | 'VLOG() should be used with numeric verbosity level. ' |
| 2666 | 'Use LOG() if you want symbolic severity levels.') |
| 2667 | |
| 2668 | # Matches invalid increment: *count++, which moves pointer instead of |
| 2669 | # incrementing a value. |