Skip to content

Commit

Permalink
set level on logger instead of handler
Browse files Browse the repository at this point in the history
  • Loading branch information
amCap1712 committed Feb 9, 2024
1 parent ed77548 commit 9878356
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions troi/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ def set_log_level(quiet):
ch = logging.StreamHandler()
if quiet:
print("set ERROR")
ch.setLevel(logging.ERROR)
logger.setLevel(logging.ERROR)
else:
print("set INFO")
ch.setLevel(logging.INFO)
logger.setLevel(logging.INFO)

ch.setFormatter(logging.Formatter("%(message)s"))
logger.addHandler(ch)

print("Logging setup:")
info("This is INFO")
error("This is ERROR")
logger.info("info 2")


def debug(msg=""):
Expand Down

0 comments on commit 9878356

Please sign in to comment.