add logger

This commit is contained in:
Kirigaya Kazuto 2022-07-11 21:14:03 +00:00
parent e60b5c2f37
commit 1c70e0b32c

10
logger.py Normal file
View File

@ -0,0 +1,10 @@
import logging
def get_logger(name=None):
logger = logging.getLogger(name)
if not logger.hasHandlers():
console_handler = logging.StreamHandler()
console_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(funcName)s: %(message)s"))
logger.addHandler(console_handler)
logger.setLevel(logging.INFO)
return logger