Add a UI log

This commit is contained in:
Eryn Wells 2023-02-12 19:44:41 -08:00
parent 36206b5cc0
commit b5f25822df

View file

@ -13,9 +13,11 @@ import os.path
# pylint: disable=unused-import
from logging import CRITICAL, DEBUG, ERROR, FATAL, INFO, NOTSET, WARN, WARNING
def _log_name(*components):
return '.'.join(['erynrl'] + list(components))
ROOT = logging.getLogger(_log_name())
AI = logging.getLogger(_log_name('ai'))
ACTIONS = logging.getLogger(_log_name('actions'))
@ -23,6 +25,8 @@ ACTIONS_TREE = logging.getLogger(_log_name('actions', 'tree'))
ENGINE = logging.getLogger(_log_name('engine'))
EVENTS = logging.getLogger(_log_name('events'))
MAP = logging.getLogger(_log_name('map'))
UI = logging.getLogger(_log_name('ui'))
def walk_up_directories_of_path(path):
'''Walk up a path, yielding each directory, until the root of the filesystem is found'''
@ -31,6 +35,7 @@ def walk_up_directories_of_path(path):
yield path
path = os.path.dirname(path)
def find_logging_config():
'''Walk up the filesystem from this script to find a logging_config.json'''
for parent_dir in walk_up_directories_of_path(__file__):
@ -43,6 +48,7 @@ def find_logging_config():
return possible_logging_config_file
def init(config_file=None):
'''
Set up the logging system by (preferrably) reading a logging configuration file.