forked from p15670423/monkey
island: Handle lower case log levels in server config
This commit is contained in:
parent
5ea241f120
commit
08668f3eae
|
@ -48,6 +48,6 @@ def setup_logging(data_dir_path, log_level):
|
||||||
logger_configuration["handlers"]["file_handler"]["filename"] = os.path.join(
|
logger_configuration["handlers"]["file_handler"]["filename"] = os.path.join(
|
||||||
data_dir_path, ISLAND_LOG_FILENAME
|
data_dir_path, ISLAND_LOG_FILENAME
|
||||||
)
|
)
|
||||||
logger_configuration["root"]["level"] = log_level
|
logger_configuration["root"]["level"] = log_level.upper()
|
||||||
|
|
||||||
logging.config.dictConfig(logger_configuration)
|
logging.config.dictConfig(logger_configuration)
|
||||||
|
|
|
@ -64,3 +64,17 @@ def test_setup_logging_console_log_level_info(capsys, tmpdir):
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert TEST_STRING not in captured.out
|
assert TEST_STRING not in captured.out
|
||||||
|
|
||||||
|
|
||||||
|
def test_setup_logging_console_log_level_lower_case(capsys, tmpdir):
|
||||||
|
DATA_DIR = tmpdir
|
||||||
|
LOG_LEVEL = "debug"
|
||||||
|
TEST_STRING = "Hello, Monkey! (Console; Log level: debug)"
|
||||||
|
|
||||||
|
setup_logging(DATA_DIR, LOG_LEVEL)
|
||||||
|
|
||||||
|
logger = logging.getLogger("TestLogger")
|
||||||
|
logger.debug(TEST_STRING)
|
||||||
|
|
||||||
|
captured = capsys.readouterr()
|
||||||
|
assert TEST_STRING in captured.out
|
||||||
|
|
Loading…
Reference in New Issue