Skip to content

Commit

Permalink
chore: removes detailed formatting from info level logs
Browse files Browse the repository at this point in the history
Signed-off-by: Jennifer Power <[email protected]>
  • Loading branch information
jpower432 committed Mar 22, 2024
1 parent 78a8974 commit 7e80c5f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions trestlebot/entrypoints/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@ def configure_logger(level: int = logging.INFO) -> None:
_logger.setLevel(level=level)

# Create a StreamHandler to send non-error logs to stdout
stdout_handler = logging.StreamHandler(sys.stdout)
stdout_handler.setLevel(logging.DEBUG)
stdout_info_handler = logging.StreamHandler(sys.stdout)
stdout_info_handler.setLevel(logging.INFO)

stdout_debug_handler = logging.StreamHandler(sys.stdout)
stdout_debug_handler.setLevel(logging.DEBUG)

# Create a StreamHandler to send error logs to stderr
stderr_handler = logging.StreamHandler(sys.stderr)
stderr_handler.setLevel(logging.ERROR)

# Create a formatter and set it on both handlers
log_formatter = logging.Formatter("%(name)s:%(lineno)d %(levelname)s: %(message)s")
stdout_handler.setFormatter(log_formatter)
stderr_handler.setFormatter(log_formatter)

_logger.addHandler(stdout_handler)
detailed_formatter = logging.Formatter(
"%(name)s:%(lineno)d %(levelname)s: %(message)s"
)
stdout_debug_handler.setFormatter(detailed_formatter)
stderr_handler.setFormatter(detailed_formatter)

_logger.addHandler(stdout_debug_handler)
_logger.addHandler(stdout_info_handler)
_logger.addHandler(stderr_handler)

0 comments on commit 7e80c5f

Please sign in to comment.