Skip to content

Instantly share code, notes, and snippets.

@xescuder
Created March 19, 2023 23:56
Show Gist options
  • Save xescuder/d36e160d4048f8f781c2422c409341cd to your computer and use it in GitHub Desktop.
Save xescuder/d36e160d4048f8f781c2422c409341cd to your computer and use it in GitHub Desktop.
Dependency injector logging configuration
core:
i18n:
language: 'es'
logging:
version: 1
formatters:
standard:
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
error:
format: "%(asctime)s - %(name)s - %(levelname)s <PID %(process)d:%(processName)s>\
\ %(name)s.%(funcName)s(): %(message)s"
handlers:
root_file_handler:
class: logging.handlers.TimedRotatingFileHandler
level: INFO
formatter: standard
filename: /Users/xescuder/Projects/investing-bot/bot/logs/logs.log
when: midnight
backupCount: 30
encoding: utf8
error_file_handler:
class: logging.handlers.TimedRotatingFileHandler
level: ERROR
formatter: error
filename: /Users/xescuder/Projects/investing-bot/bot/logs/logs.log
when: midnight
backupCount: 20
encoding: utf8
screener_file_handler:
class: logging.handlers.TimedRotatingFileHandler
level: DEBUG
formatter: standard
filename: /Users/xescuder/Projects/investing-bot/bot/logs/screener.log
when: midnight
backupCount: 30
encoding: utf8
console:
class: logging.StreamHandler
level: DEBUG
formatter: standard
stream: ext://sys.stdout
root:
level: INFO
handlers: [console, root_file_handler, error_file_handler]
loggers:
screener:
level: DEBUG
handlers: [console, screener_file_handler]
propagate: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment