You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import coloredlogs
import logging
log = logging.getLogger(__name__)
# Figure out the how long the field needs to be
w = max(len(s) for s in coloredlogs.find_defined_levels().keys())
# Specify minimum width in the log format
coloredlogs.install(
level="DEBUG", logger=log, fmt=f"%(filename)s %(levelname)-{w}s %(message)s"
)
# Print some logs
log.debug("Don't mind me")
log.info("Just testing logs")
log.warning("Not sure if this will work")
log.error("Actually I should probably check first")
log.critical("Let me do that and come back")
The default log format misaligns log messages of different types:
It would be great if by default
coloredlogs
worked like:The text was updated successfully, but these errors were encountered: