Add logging

This commit is contained in:
Zed 2023-03-02 17:48:35 -06:00
parent f1db0f62fc
commit 17774ae0e2

View File

@ -4,6 +4,8 @@
# pylint: disable=missing-module-docstring
import logging
from database.models import database, GameModel as Game
@ -24,6 +26,18 @@ class BaseGameManager:
# Discord client instance
self.discord = None
logger = logging.getLogger()
console = logging.StreamHandler()
format_str = '%(asctime)s\t%(levelname)s -- %(processName)s %(filename)s:%(lineno)s -- %(message)s'
console.setFormatter(logging.Formatter(format_str))
logger.addHandler(console)
logger.setLevel(logging.DEBUG)
self.logger = logger
def __enter__(self):
"""
Allows use of `with Game() as game` for try/except statements