From b5f25822dfbbcf1b9ad23a54c1516ba35b435d9a Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 12 Feb 2023 19:44:41 -0800 Subject: [PATCH] Add a UI log --- erynrl/log.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erynrl/log.py b/erynrl/log.py index d61295e..352095b 100644 --- a/erynrl/log.py +++ b/erynrl/log.py @@ -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.