-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces convenient logging functions for usage in loops:
The functions with the postfix `_once` only log when they are called for the first time. This is useful when used inside loops while the arguments to be logged do not change. The current alternatives (`logging.info`, `logging.warning`, etc.) can load the log too heavily here. * `log_once(level, msg, *args)` Logs only the first call. (Forwards to `log_first_n`) * `debug_once(msg, *args)` forwards to `log_once`. * `info_once(msg, *args)` forwards to `log_once`. * `warning_once(msg, *args)` forwards to `log_once`. * `error_once(msg, *args)` forwards to `log_once`. * `fatal_once(msg, *args)` forwards to `log_once`. PiperOrigin-RevId: 535561745
- Loading branch information
1 parent
6929bf0
commit bbe3472
Showing
2 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters