Conditions | 2 |
Total Lines | 13 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import logging |
||
28 | def format(self, record: LogRecord) -> str: |
||
29 | message = record.msg |
||
30 | levelname = record.levelname |
||
31 | timestamp = datetime.utcfromtimestamp(record.created) |
||
32 | ts = ( |
||
33 | timestamp.replace(tzinfo=timezone.utc) |
||
34 | .astimezone(tz=timezone(timedelta(hours=3))) |
||
35 | .strftime("%d.%m.%Y %H:%M:%S") |
||
36 | ) |
||
37 | log = f"[{levelname}]: {ts}\n{message}" |
||
38 | if record.exc_info: |
||
39 | log += f"\n{record.exc_info[1].__repr__()}" |
||
40 | return log |
||
41 | |||
52 |