cc: rename DEFAULT_LOGGING_CONFIG_PATH -> DEFAULT_LOGGER_CONFIG_PATH
This commit is contained in:
parent
74e0dfddc5
commit
5b781c50a4
|
@ -7,7 +7,7 @@ import json # noqa: E402
|
|||
from monkey_island.cc.main import main # noqa: E402
|
||||
from monkey_island.cc.consts import (
|
||||
DEFAULT_SERVER_CONFIG_PATH,
|
||||
DEFAULT_LOGGING_CONFIG_PATH,
|
||||
DEFAULT_LOGGER_CONFIG_PATH,
|
||||
) # noqa: E402
|
||||
from monkey_island.cc.island_logger import json_setup_logging # noqa: E402
|
||||
|
||||
|
@ -34,23 +34,23 @@ def parse_cli_args():
|
|||
default=DEFAULT_SERVER_CONFIG_PATH,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--logging-config",
|
||||
"--logger-config",
|
||||
action="store",
|
||||
help="The path to the logging configuration file.",
|
||||
default=DEFAULT_LOGGING_CONFIG_PATH,
|
||||
default=DEFAULT_LOGGER_CONFIG_PATH,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
return (args.setup_only, args.server_config, args.logging_config)
|
||||
return (args.setup_only, args.server_config, args.logger_config)
|
||||
|
||||
|
||||
if "__main__" == __name__:
|
||||
(is_setup_only, server_config, logging_config) = parse_cli_args()
|
||||
(is_setup_only, server_config, logger_config) = parse_cli_args()
|
||||
|
||||
# This is here in order to catch EVERYTHING, some functions are being called on
|
||||
# imports, so the log init needs to be first.
|
||||
try:
|
||||
json_setup_logging(logging_config)
|
||||
json_setup_logging(logger_config)
|
||||
except (json.JSONDecodeError) as ex:
|
||||
print(f"Error loading logging config: {ex}")
|
||||
exit(1)
|
||||
|
|
|
@ -13,6 +13,6 @@ DEFAULT_DEVELOP_SERVER_CONFIG_PATH = os.path.join(
|
|||
MONKEY_ISLAND_ABS_PATH, "cc", "server_config.json.develop"
|
||||
)
|
||||
|
||||
DEFAULT_LOGGING_CONFIG_PATH = os.path.join(
|
||||
DEFAULT_LOGGER_CONFIG_PATH = os.path.join(
|
||||
MONKEY_ISLAND_ABS_PATH, "cc", "island_logger_default_config.json"
|
||||
)
|
||||
|
|
|
@ -3,13 +3,13 @@ import logging.config
|
|||
import os
|
||||
from typing import Dict
|
||||
|
||||
from monkey_island.cc.consts import DEFAULT_LOGGING_CONFIG_PATH
|
||||
from monkey_island.cc.consts import DEFAULT_LOGGER_CONFIG_PATH
|
||||
|
||||
__author__ = "Maor.Rayzin"
|
||||
|
||||
|
||||
def json_setup_logging(
|
||||
default_path=DEFAULT_LOGGING_CONFIG_PATH,
|
||||
default_path=DEFAULT_LOGGER_CONFIG_PATH,
|
||||
default_level=logging.INFO,
|
||||
env_key="LOG_CFG",
|
||||
):
|
||||
|
|
|
@ -4,7 +4,7 @@ import os
|
|||
from monkey_island.cc.consts import MONKEY_ISLAND_ABS_PATH
|
||||
from monkey_island.cc.island_logger import json_setup_logging
|
||||
|
||||
TEST_LOGGING_CONFIG_PATH = os.path.join(MONKEY_ISLAND_ABS_PATH, "cc", "testing",
|
||||
TEST_LOGGER_CONFIG_PATH = os.path.join(MONKEY_ISLAND_ABS_PATH, "cc", "testing",
|
||||
"logger_config.json")
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ def test_expanduser_filename(monkeypatch, tmpdir):
|
|||
|
||||
set_home_env(monkeypatch, tmpdir)
|
||||
|
||||
json_setup_logging(TEST_LOGGING_CONFIG_PATH)
|
||||
json_setup_logging(TEST_LOGGER_CONFIG_PATH)
|
||||
|
||||
logger = logging.getLogger("TestLogger")
|
||||
logger.info(TEST_STRING)
|
||||
|
|
Loading…
Reference in New Issue