Silence Kedro Logs
Kedro can have a chatty logger. While this is super nice in production
so see everything that happened during a pipeline run. This can be troublesome
while trying to implement a cli extension with clean output.
Silence a Python log # [1]
First, how does one silence a python log? Python loggers can be retrieved by
the logging module’s getLogger function. Then their log level can be
changed. Much of kedro’s chattiness comes from INFO level logs. I don’t want
to hear about anything for my current use case unless it’s essential, i.e., a
failure. In this case, I set the log levels to ERROR as most errors should
stop execution anyways.
python logging levels # [2]
Level
Numeric value
CRITICAL
50
ERROR
40
WARNING
30
INFO
20
DEBUG
10
NOTSET
0
Get or Create a logger # [3]
Getting a python logger is straightforward if we know the name of the logger.
The following block will grab the logger object for the logger currently
registered under the name passed in.
logger = logging.getLog...