23 ms·
Actually, you don't configure it at all in your library. Just import logging, then call logging.{debug,info,whatever} as needed. The idiom is to do all configur
by kstrauser 15y ago
Actually, you don't configure it at all in your library. Just import logging, then call logging.{debug,info,whatever} as needed. The idiom is to do all configuration in the app which uses your libraries, such as looking for "-d" or "-dd" in sys.argv to set the logging level.
- jdunck 15y agoNo, please don't call "logging.whatever" as needed. That uses the root logger, and that removes the consumer's ability to tune different loggers. logger = logging.getLogger("libname.foo") logger.<whatever> is much more useful and polite. Using the top-level logger is like putting this in your library: __builtins__.__dict__.update(globals()) Bad form.