Skip to content

Instantly share code, notes, and snippets.

@SerhatTeker
Last active July 14, 2019 14:48
Show Gist options
  • Save SerhatTeker/13d31a2159cd88c31a8cd464df115789 to your computer and use it in GitHub Desktop.
Save SerhatTeker/13d31a2159cd88c31a8cd464df115789 to your computer and use it in GitHub Desktop.
Python logging configuration template
[loggers]
keys=root
[logger_root]
level=DEBUG
handlers=screen,file
[formatters]
keys=simple,verbose
[formatter_simple]
format=%(asctime)s [%(levelname)s] %(name)s: %(message)s
[formatter_verbose]
format=[%(asctime)s] %(levelname)s [%(filename)s %(name)s %(funcName)s (%(lineno)d)]: %(message)s
[handlers]
keys=file,screen
[handler_file]
class=handlers.TimedRotatingFileHandler
interval=midnight
backupCount=5
formatter=verbose
level=DEBUG
args=('run/logs/debug/general.log',)
[handler_screen]
class=StreamHandler
formatter=simple
level=DEBUG
args=(sys.stdout,)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment