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.py8
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='%')