#  Copyright (C) 2024. Hao Zheng
#  All rights reserved.

import logging

from colorlog import ColoredFormatter

handler = logging.StreamHandler()

formatter = ColoredFormatter(
    "%(log_color)s [%(asctime)s] %(levelname)-8s [%(threadName)s] %(message)s",
    datefmt="%Y-%m-%d %H:%M:%S",
    reset=True,
    log_colors={"DEBUG": "cyan", "INFO": "green", "WARNING": "yellow", "ERROR": "red", "CRITICAL": "red,bg_white"},
    secondary_log_colors={},
    style="%",
)
handler.setFormatter(formatter)

logger = logging.getLogger("openlrc")
logger.handlers.clear()  # Clear existing handlers
logger.addHandler(handler)
logger.propagate = False

logger.setLevel("INFO")
