Skip to content

Instantly share code, notes, and snippets.

@Hu-Wentao
Created November 16, 2024 18:58
Show Gist options
  • Select an option

  • Save Hu-Wentao/766b839356cf638803e9fe5e7fcc18a3 to your computer and use it in GitHub Desktop.

Select an option

Save Hu-Wentao/766b839356cf638803e9fe5e7fcc18a3 to your computer and use it in GitHub Desktop.
loguru config
def set_logger(log_level: str):
import sys
from loguru import logger
logger.remove()
logger.level(log_level)
logger.add(
sys.stdout,
format='<green>{time:YY-MM-DD HH:mm:ss}</green>| '
'<level>{level}</level>| '
'<cyan>{module}:{function}:{line} ({process}) </cyan>'
'<level>{message}</level>',
colorize=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment