Reputation: 2591
I have just started using the coloredlogs package in Python. I am using the version 15.0. I can see that my message changes color depending on its log level (info, debug, warning e.t.c.). However, the other parts of the message remain the same color as shown below:
The code I used for this is below:
import coloredlogs, logging
# Create a logger object.
logger = logging.getLogger("main")
# If you don't want to see log messages from libraries, you can pass a
# specific logger object to the install() function. In this case only log
# messages originating from that logger will show up on the terminal.
coloredlogs.install(level='DEBUG', logger=logger, fmt='%(name)s - %(levelname)s - %(message)s')
# Some examples.
logger.debug("this is a debugging message")
logger.info("this is an informational message")
logger.warning("this is a warning message")
logger.error("this is an error message")
logger.critical("this is a critical message")
Upvotes: 4
Views: 268