diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2022-11-27 06:44:07 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2022-11-27 06:44:07 -0600 |
commit | 98bfded1b407431ad62642d7f029e4e5f3534c07 (patch) | |
tree | 8f38dd229fe54889d130eb0838c9c47619e96376 /src/pyssg/per_level_formatter.py | |
parent | 9ea43f16d6440dce54ae7f78d46618d25e52f6ec (diff) |
refactor code and fix type checks
still need to refactor more code before migrating to yaml config file
Diffstat (limited to 'src/pyssg/per_level_formatter.py')
-rw-r--r-- | src/pyssg/per_level_formatter.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pyssg/per_level_formatter.py b/src/pyssg/per_level_formatter.py index 5ab3946..04f943b 100644 --- a/src/pyssg/per_level_formatter.py +++ b/src/pyssg/per_level_formatter.py @@ -1,4 +1,4 @@ -from logging import Formatter, DEBUG, INFO, WARNING, ERROR, CRITICAL +from logging import Formatter, LogRecord, DEBUG, INFO, WARNING, ERROR, CRITICAL # only reason for this class is to get info formatting as normal text # and everything else with more info and with colors @@ -20,8 +20,10 @@ class PerLevelFormatter(Formatter): } - def format(self, record: str) -> str: - fmt: str = self.__FORMATS.get(record.levelno) + 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='%') |