-
-
Save hexsprite/5789517 to your computer and use it in GitHub Desktop.
Django Logsna example
This file contains hidden or 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
| from .settings import * | |
| LOGGING['formatters']['logsna'] = {'()': 'logsna.Formatter'} | |
| db_handler = {'level': 'INFO', | |
| 'class': 'logging.handlers.RotatingFileHandler', | |
| 'filename': here('logs', 'db.log'), | |
| 'maxBytes': 4194304, | |
| 'formatter': 'logsna', | |
| 'backupCount': 1} | |
| auth_handler = dict(db_handler, filename=here('logs', 'auth.log')) | |
| LOGGING['handlers']['db-file'] = db_handler | |
| LOGGING['handlers']['auth-file'] = auth_handler | |
| LOGGING['loggers']['django.db']['handlers'] = ['db-file'] | |
| LOGGING['loggers']['myapp.module'] = {'handlers': ['auth-file']} | |
| for formatter in LOGGING['formatters']: | |
| LOGGING['formatters'][formatter] = {'()': 'logsna.Formatter'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment