Skip to content

sirex/configlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

configlog

Eache to use python logging configuration with sane defaults.

Quick start

Imperative configuration:

import configlog

configlog.defaults('django')
configlog.set('', 'error', file='%(here)s/logs/errors.log')
configlog.set('myproject', handler='console', formatter='default')
configlog.set('myproject.errors', 'error', 'sentry')
configlog.set('myproject.debug', level='debug', handler='null')
configlog.configure()

Declarative configuration:

import configlog

configlog.configure([
    'defaults=django'
    'level=error file=%(here)s/logs/errors.log',
    'myproject handler=console formatter=default',
    'myproject.errors error sentry',
    'myproject.debug level=debug handler=null',
])

Imperative and declarative configurations mixed together:

import configlog

(
    configlog.Configurator().
    defaults('django').
    set('', level='error', file='%(here)s/logs/errors.log').
    set('myproject', handler='console', formatter='default').
    set([
        'myproject.errors error sentry',
        'myproject.debug level=debug handler=null',
    ]).
    configure()
)

About

A tool to make python logging configuration easier.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages