convenient python stdlib logging configuration
Project description
logconf
Setting up logging in Python is verbose and error prone. This library aims to fix that, without replacing the standard library logging entirely.
import logging from logconf import global_logconf with global_logconf() as logger: # simple example: logger.log_to_console_if_interactive(level=logging.DEBUG) if os.getenv('LOG_DEST'): # can be "stdout" or "stderr" logger.log_to_file(os.getenv('LOG_DEST'), level=os.getenv('LOG_LEVEL')) # more fine-grained control: logger.log_json_to_file('/var/log/myapp.jsonlog', level=logging.WARNING) logger.log_json_to_file('/var/log/myapp_debug.jsonlog', level=logging.DEBUG) # configure sub-loggers: with logger.logger('urllib3') as sublogger: sublogger.level = logging.WARNING with logger.logger('myapp.security') as sublogger: sublogger.log_to_file('/var/log/myapp.security.log', level=logging.INFO)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
logconf-0.2.1.tar.gz
(4.6 kB
view hashes)
Built Distribution
logconf-0.2.1-py3-none-any.whl
(10.4 kB
view hashes)