Log 'msg % args' at level 'level' once per 'n' times. Logs the 1st call, (N+1)st call, (2N+1)st call, etc. Not threadsafe. Args: level: The level at which to log. msg: The message to be logged. n: The number of times this should be called before it is logged. *args: Th
(level, msg, n, *args)
| 154 | |
| 155 | |
| 156 | def log_every_n(level, msg, n, *args): |
| 157 | """Log 'msg % args' at level 'level' once per 'n' times. |
| 158 | |
| 159 | Logs the 1st call, (N+1)st call, (2N+1)st call, etc. |
| 160 | Not threadsafe. |
| 161 | |
| 162 | Args: |
| 163 | level: The level at which to log. |
| 164 | msg: The message to be logged. |
| 165 | n: The number of times this should be called before it is logged. |
| 166 | *args: The args to be substituted into the msg. |
| 167 | """ |
| 168 | count = _GetNextLogCountPerToken(_GetFileAndLine()) |
| 169 | log_if(level, msg, not (count % n), *args) |
| 170 | |
| 171 | |
| 172 | def log_first_n(level, msg, n, *args): # pylint: disable=g-bad-name |
nothing calls this directly
no test coverage detected
searching dependent graphs…