Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python logbook - how to dynamically control logging level

Tags:

python

logging

I have recently switched from using 'logging' to 'logbook'.
So far, so good, but I am missing one critical functionality - ability to change the minimum level during runtime.
In 'logging', I can call myLogger.setLevel(logging.INFO), but there is no equivalent method in logbook.
Anyone?

like image 454
Amir Katz Avatar asked Jul 30 '26 08:07

Amir Katz


1 Answers

Very simple (and undocumented) - modify the 'level' attribute:
myLogger.level = logbook.INFO

like image 181
Amir Katz Avatar answered Aug 01 '26 20:08

Amir Katz