-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Awesome library! I wish I'd thought to google for this when writing dozens of DEBUG log messages with expensive string formatting, usually pprint. For example the following is incomplete, the expensive call to pprint.pformat may still happen for some logging configurations:
if logger.isEnabledFor(logging.DEBUG):
logger.debug("Processing large data shape:\n%s", pprint.pformat(data_dict))
This might make a good example to include in the docs to help potential users imagine why they might use this. Untested, but in this case the expensive call should never happen unless this logging record is actually going to be emitted:
logger.debug(
"Processing large data shape:\n%s",
lazy_string.LazyString(functools.partial(pprint.pformat, data_dict)),
)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels