Skip to content

Instantly share code, notes, and snippets.

@kien-truong
Last active August 9, 2023 20:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kien-truong/1500194 to your computer and use it in GitHub Desktop.
Save kien-truong/1500194 to your computer and use it in GitHub Desktop.
Example log dictionary config in pure python
logconfig = {
"version": 1,
"disable_existing_loggers": 0,
"root": {
"level": "DEBUG",
"handlers": [
"console",
"file",
"debugfile"
]
},
"loggers": {
},
"formatters": {
"precise": {
"format": "%(asctime)s %(name)-15s %(levelname)-8s %(message)s"
},
"brief": {
"format": "%(levelname)-8s: %(name)-15s: %(message)s"
}
},
"handlers": {
"debugfile": {
"class": "logging.FileHandler",
"formatter": "precise",
"mode": "a",
"level": "DEBUG",
"filename": "log/debug.log"
},
"console": {
"formatter": "precise",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout",
"level": "DEBUG"
},
"file": {
"formatter": "precise",
"backupCount": 3,
"level": "WARNING",
"maxBytes": 10240000,
"class": "logging.handlers.RotatingFileHandler",
"filename": "log/rotate.log"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment