Journal module
a journal module to handle complex log system
- class journalism.Journal(cfg=None)
The main class
- Parameters:
config – dict containing a journal config
- add_config(config)
allow you to load new config into the journal
- add_level(level_name, level_num, erase=False)
allow you to add a new level to loggers , each level need a name and a value between 0 and 50
- Parameters:
level_name (str) – the name you want to give it
level_num (int) – the level you want to give it
erase (bool) – allow to replace level if value already exist
- add_log(name, config='default')
allow you to create a new logger instance
- Parameters:
name (str) – the name of the new logger you want to create
config (str) – the name of a config you loaded before
- handlers()
return the list of configured handlers
- levels()
returned the list of configured levels
- loggers()
return the list of configured loggers
- journalism.gen_config(name, level=None, format_string=None, loggers=None, handlers=None)
allows you to generate a single config
- Parameters:
name (str) – the name of the config
level (int) – the level above which the loggers will catch the messages
format_string (str) – allow to format what will be log in the file
loggers (list) – the list of the names of the loggers to be created using this config
handlers (list) – where should the catched messages be written
- Warning:
for individual handlers reffer to gen_handler
- journalism.gen_handler(name, handler_type, level)
allow you to generate singular handlers
- Parameters:
name (str) – of the handler ( the name of the file if this is for a file handler )
handler_type (str) – the type of handler ( file , console , WEB … )
level (int) – the level above which message should be written by the handler
- Warning:
currently only basic file and stream handlers are implemented