Add a UI log
This commit is contained in:
parent
36206b5cc0
commit
b5f25822df
1 changed files with 6 additions and 0 deletions
|
@ -13,9 +13,11 @@ import os.path
|
||||||
# pylint: disable=unused-import
|
# pylint: disable=unused-import
|
||||||
from logging import CRITICAL, DEBUG, ERROR, FATAL, INFO, NOTSET, WARN, WARNING
|
from logging import CRITICAL, DEBUG, ERROR, FATAL, INFO, NOTSET, WARN, WARNING
|
||||||
|
|
||||||
|
|
||||||
def _log_name(*components):
|
def _log_name(*components):
|
||||||
return '.'.join(['erynrl'] + list(components))
|
return '.'.join(['erynrl'] + list(components))
|
||||||
|
|
||||||
|
|
||||||
ROOT = logging.getLogger(_log_name())
|
ROOT = logging.getLogger(_log_name())
|
||||||
AI = logging.getLogger(_log_name('ai'))
|
AI = logging.getLogger(_log_name('ai'))
|
||||||
ACTIONS = logging.getLogger(_log_name('actions'))
|
ACTIONS = logging.getLogger(_log_name('actions'))
|
||||||
|
@ -23,6 +25,8 @@ ACTIONS_TREE = logging.getLogger(_log_name('actions', 'tree'))
|
||||||
ENGINE = logging.getLogger(_log_name('engine'))
|
ENGINE = logging.getLogger(_log_name('engine'))
|
||||||
EVENTS = logging.getLogger(_log_name('events'))
|
EVENTS = logging.getLogger(_log_name('events'))
|
||||||
MAP = logging.getLogger(_log_name('map'))
|
MAP = logging.getLogger(_log_name('map'))
|
||||||
|
UI = logging.getLogger(_log_name('ui'))
|
||||||
|
|
||||||
|
|
||||||
def walk_up_directories_of_path(path):
|
def walk_up_directories_of_path(path):
|
||||||
'''Walk up a path, yielding each directory, until the root of the filesystem is found'''
|
'''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
|
yield path
|
||||||
path = os.path.dirname(path)
|
path = os.path.dirname(path)
|
||||||
|
|
||||||
|
|
||||||
def find_logging_config():
|
def find_logging_config():
|
||||||
'''Walk up the filesystem from this script to find a logging_config.json'''
|
'''Walk up the filesystem from this script to find a logging_config.json'''
|
||||||
for parent_dir in walk_up_directories_of_path(__file__):
|
for parent_dir in walk_up_directories_of_path(__file__):
|
||||||
|
@ -43,6 +48,7 @@ def find_logging_config():
|
||||||
|
|
||||||
return possible_logging_config_file
|
return possible_logging_config_file
|
||||||
|
|
||||||
|
|
||||||
def init(config_file=None):
|
def init(config_file=None):
|
||||||
'''
|
'''
|
||||||
Set up the logging system by (preferrably) reading a logging configuration file.
|
Set up the logging system by (preferrably) reading a logging configuration file.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue