forked from c0de/BaseballBot
Add logging
This commit is contained in:
parent
f1db0f62fc
commit
17774ae0e2
14
game/base.py
14
game/base.py
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user