Install coloredlogs for terminal output
masterThe primary entry point for using coloredlogs is the coloredlogs.install() function. By default, calling install() attaches a handler to the root logger, which means log messages from both your application code and any third-party libraries will be colored in the terminal.
If you want to restrict colored output to only your application's logs and ignore library logs, pass your specific logger object to the install() function instead of calling it without arguments.
import logging
import coloredlogs
# Option 1: Install on the root logger (shows everything)
coloredlogs.install()
# Option 2: Install on a specific logger (shows only your app logs)
logger = logging.getLogger(__name__)
coloredlogs.install(logger=logger)