Logging
Last updated
[log.colorlog]
file = /path/to/config/file
level = info
to_console = true
rotate = true
max_bytes = 512000
max_files = 4from cement import App, init_defaults
META = init_defaults('log.logging')
META['log.logging']['log_level_argument'] = ['-l', '--level']
class MyApp(App):
class Meta:
label = 'myapp'
meta_defaults = META$ python myapp.py --help
usage: myapp [-h] [--debug] [--quiet] [-l {info,warning,error,debug,fatal}]
optional arguments:
-h, --help show this help message and exit
--debug full application debug mode
--quiet suppress all output
-l {info,warning,error,debug,fatal}
logging level
$ python myapp.py
INFO: This is an info message
WARNING: This is an warning message
ERROR: This is an error message
CRITICAL: This is a fatal message
$ python myapp.py -l error
ERROR: This is an error message
CRITICAL: This is a fatal message