Skip to content

Commit

Permalink
fix: AttributeError on py3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Jul 3, 2024
1 parent 46752ce commit 6e7a261
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/logger/log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import platform
import platform, sys
import logging
from datetime import datetime, timezone

Expand Down Expand Up @@ -47,7 +47,10 @@ def format(self, record: logging.LogRecord):
logstr += log_level_msg_str.get(record.levelno, record.levelname)
if self.color:
logstr += colorReset
fn = record.filename.removesuffix(".py")
if sys.version_info >= (3, 9):
fn = record.filename.removesuffix(".py")
elif record.filename.endswith(".py"):
fn = record.filename[:-3]
logstr += f"] {str(record.name)} | {fn} | {str(record.msg)%record.args}"
return logstr

Expand Down

0 comments on commit 6e7a261

Please sign in to comment.