From 189c593cef5649f42ba14b4cb3f1888cacb5716e Mon Sep 17 00:00:00 2001 From: amoghjalan Date: Fri, 19 Apr 2024 16:14:07 +0530 Subject: [PATCH] Update Logger system to enable custom logging --- apiserver/dora/utils/log.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apiserver/dora/utils/log.py b/apiserver/dora/utils/log.py index db3455c81..c7c8882e3 100644 --- a/apiserver/dora/utils/log.py +++ b/apiserver/dora/utils/log.py @@ -1,3 +1,17 @@ import logging LOG = logging.getLogger() + + +def custom_logging(func): + def wrapper(*args, **kwargs): + print( + f"[{func.__name__.upper()}]", args[0] + ) # Assuming the first argument is the log message + return func(*args, **kwargs) + + return wrapper + + +LOG.error = custom_logging(LOG.error) +LOG.info = custom_logging(LOG.info)