Is there a way to get the effective log level of a structlog logger? I want to do something like the following:
import structlog
logger = structlog.get_logger()
if logger.isEnabledFor(DEBUG):
some_expensive_report()
I'm looking for something like isEnabledFor from the standard library logging module. Does such a thing exist?
Update: It looks like I can use logger.bind().isEnabledFor()
, but only if I configure struct log with structlog.configure(wrapper_class=structlog.stdlib.BoundLogger)
. Is this the answer?