Last active
August 9, 2023 20:18
-
-
Save kien-truong/1500194 to your computer and use it in GitHub Desktop.
Example log dictionary config in pure python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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