From 6f3ee15c04ec96f6e97efd7c216e35a6991c15e0 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Tue, 4 Aug 2020 09:37:07 +0200 Subject: [PATCH] pagure: setup the LOGGING_GIT_HOOKS configuration key Signed-off-by: Pierre-Yves Chibon --- roles/pagure/frontend/templates/pagure.cfg | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/roles/pagure/frontend/templates/pagure.cfg b/roles/pagure/frontend/templates/pagure.cfg index 8b33d0a290..2af758ed5c 100644 --- a/roles/pagure/frontend/templates/pagure.cfg +++ b/roles/pagure/frontend/templates/pagure.cfg @@ -319,6 +319,63 @@ LOGGING = { } } +LOGGING_GIT_HOOKS = { + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'standard': { + 'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s' + }, + 'email_format': { + 'format': MSG_FORMAT + } + }, + 'filters': { + 'myfilter': { + '()': ContextInjector, + } + }, + 'handlers': { + 'console': { + 'formatter': 'standard', + 'class': 'logging.StreamHandler', + 'stream': 'ext://sys.stdout', + 'level': 'WARN', + }, + 'email': { + 'level': 'ERROR', + 'formatter': 'email_format', + 'class': 'logging.handlers.SMTPHandler', + 'mailhost': 'localhost', + 'fromaddr': 'pagure@pagure.io', + 'toaddrs': 'pingou@pingoured.fr', + 'subject': 'ERROR on pagure.io', + 'filters': ['myfilter'], + }, + "auth_handler": { + "formatter": "standard", + "class": "logging.handlers.TimedRotatingFileHandler", + "filename": "/var/log/pagure/pagure_auth.log", + "backupCount": 10, + "utc": True, + "when": "midnight", + }, + }, + # The root logger configuration; this is a catch-all configuration + # that applies to all log messages not handled by a different logger + 'root': { + 'level': 'WARN', + 'handlers': ['console', 'email'], + }, + 'loggers': { + "pagure_auth": { + "level": "DEBUG", + "handlers": ["auth_handler"], + "propagate": False, + }, + } +} + CROSS_PROJECT_ACLS = [ 'create_project', 'fork_project',