summaryrefslogtreecommitdiff
path: root/src/pyssg/per_level_formatter.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pyssg/per_level_formatter.py')
-rw-r--r--src/pyssg/per_level_formatter.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/pyssg/per_level_formatter.py b/src/pyssg/per_level_formatter.py
index 04f943b..394471e 100644
--- a/src/pyssg/per_level_formatter.py
+++ b/src/pyssg/per_level_formatter.py
@@ -4,10 +4,10 @@ from logging import Formatter, LogRecord, DEBUG, INFO, WARNING, ERROR, CRITICAL
# and everything else with more info and with colors
class PerLevelFormatter(Formatter):
# colors for the terminal in ansi
- __YELLOW: str = "\x1b[33m"
- __RED: str = "\x1b[31m"
- __BOLD_RED: str = "\x1b[31;1m"
- __RESET: str = "\x1b[0m"
+ __YELLOW: str = '\x1b[33m'
+ __RED: str = '\x1b[31m'
+ __BOLD_RED: str = '\x1b[31;1m'
+ __RESET: str = '\x1b[0m'
__DATE_FMT: str = '%Y-%m-%d %H:%M:%S'
__COMMON_FMT: str = '[%(levelname)s] [%(module)s:%(funcName)s:%(lineno)d]: %(message)s'
@@ -19,12 +19,10 @@ class PerLevelFormatter(Formatter):
CRITICAL: f'{__BOLD_RED}{__COMMON_FMT}{__RESET}'
}
-
def format(self, record: LogRecord) -> str:
# this should never fail, as __FORMATS is defined above,
# so no issue of just converting to str
fmt: str = str(self.__FORMATS.get(record.levelno))
formatter: Formatter = Formatter(
fmt=fmt, datefmt=self.__DATE_FMT, style='%')
-
return formatter.format(record)