python logurur日志用法记录


import sys

from loguru import logger

logger.configure(handlers=[
    {
        "sink": sys.stderr,
        "format": "<lvl>{time:YYYY-MM-DD HH:mm:ss.SSS} - {name}:{module}:{line:4} - {level:7} - {message}</>",
        "colorize": True,
        "level":"INFO"
    },
    {
        "sink": '红外{time:YYYY-MM-DD-HH-mm}.log',
        "format": "{time:YYYY-MM-DD HH:mm:ss.SSS} - {name}:{module}:{line:4} - {level:7} - {message}",
        "colorize": True,
        "level":"DEBUG"
    },
])

logger.debug('this is debug')
logger.info('this is info')
logger.warning('this is warning')
logger.error('this is error')
logger.critical('this is critical')


posted @ 2023-07-26 09:22  不能说的秘密  阅读(40)  评论(0编辑  收藏  举报