import sys from loguru import logger logger.remove() logger_str_format = ( "{time:YYYY-MM-DD HH:mm:ss} | " "{level: <8} | " "{line: <5}| " "{extra[session_name]: <7} | " "{message}" ) logger.add(sink=sys.stdout, format=logger_str_format, colorize=True) log = logger.bind(session_name="GLOBAL").opt(colors=True)