Skip to content

Commit

Permalink
Fix logging issue
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Feb 5, 2024
1 parent faf9922 commit 631f953
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/hatch_openzim/shared.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import logging
import os
import sys

DEFAULT_FORMAT = "%(name)s:%(levelname)s:%(message)s"

# create logger
logger = logging.getLogger("hatch_openzim")
logger.setLevel(logging.DEBUG)

# setup console logging
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setFormatter(logging.Formatter(DEFAULT_FORMAT))
log_level = logging.getLevelName(os.getenv("HATCH_OPENZIM_LOG_LEVEL", "INFO"))
logger.setLevel(log_level)
console_handler.setLevel(log_level)
logger.addHandler(console_handler)

0 comments on commit 631f953

Please sign in to comment.