MihoyoBBSTools/loghelper.py
2022-01-06 13:49:25 +08:00

17 lines
569 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
import logging
# Log输出这里提供了自定义logging输出的机会只需要创建一个logging.ini并且写入配置文件即可自定义输出
file_path = os.path.dirname(os.path.realpath(__file__)) + "/config/logging.ini"
if os.path.exists(file_path):
import logging.config
logging.config.fileConfig(file_path)
log = logging.getLogger("AutoMihoyoBBS")
else:
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s %(levelname)s %(message)s',
datefmt='%Y-%m-%dT%H:%M:%S')
log = logger = logging