修复多重log问题

This commit is contained in:
Pentacene 2021-03-04 00:51:22 +08:00 committed by GitHub
parent 186c709801
commit bbc1dca904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,9 +20,10 @@ logs = getLogger(__name__)
logging_format = "%(levelname)s [%(asctime)s] [%(name)s] %(message)s" logging_format = "%(levelname)s [%(asctime)s] [%(name)s] %(message)s"
logging_handler = StreamHandler() logging_handler = StreamHandler()
logging_handler.setFormatter(ColoredFormatter(logging_format)) logging_handler.setFormatter(ColoredFormatter(logging_format))
logs.addHandler(logging_handler) root_logger = logging.getLogger()
root_logger.setLevel(logging.ERROR)
root_logger.addHandler(logging_handler)
basicConfig(level=INFO) basicConfig(level=INFO)
getLogger('telethon').setLevel(INFO)
logs.setLevel(INFO) logs.setLevel(INFO)
try: try: