Colorful Python Logging
pip install colorlogging
colorlogging
is a tool for making Python logging more colorful.
This project is dependency-free and therefore it is very lightweight. Here is an example of colorful logs:
Installation
Simply run
pip install colorlogging
Usage
To configure logging, call configure_logging
like so:
import colorlogging
import logging
logger = logging.getLogger(__name__)
def main() -> None:
colorlogging.configure()
logger.info("Hello, world!")
This tool also provides some other helpful display functions:
import colorlogging
colorlogging.show_info("This is a status message", important=True)
colorlogging.show_warning("This is a warning message")
colorlogging.show_error("This is an error message")
This shows the following output: