Skip to content

Commit

Permalink
fix: resolve incorrect logging configuration issues(#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lexiay committed Feb 10, 2025
1 parent ac92dc2 commit ff8236a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cozepy/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ def setup_logging(level: int = logging.WARNING) -> None:
]:
raise ValueError(f"invalid log level: {level}")

logging.basicConfig(
format="[cozepy][%(levelname)s][%(asctime)s] %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
console_handler = logging.StreamHandler()
console_handler.setLevel(level)

formatter = logging.Formatter("[%(name)s][%(levelname)s][%(asctime)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
console_handler.setFormatter(formatter)

logger.addHandler(console_handler)
logger.setLevel(level)


Expand Down

0 comments on commit ff8236a

Please sign in to comment.