From e8819cfd01ea9ad938dd2c706fbc77c33e6796ca Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 29 Nov 2023 16:49:56 -0800 Subject: [PATCH] Troubleshooting log init --- chatbot_core/utils/bot_utils.py | 4 ++-- chatbot_core/utils/logger.py | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/chatbot_core/utils/bot_utils.py b/chatbot_core/utils/bot_utils.py index a68272f..4c49d0f 100644 --- a/chatbot_core/utils/bot_utils.py +++ b/chatbot_core/utils/bot_utils.py @@ -45,7 +45,7 @@ import yaml from klat_connector import start_socket -from chatbot_core.utils.logger import LOG +from ovos_utils.log import LOG # Causes circular imports # from chatbot_core import ChatBot @@ -661,7 +661,7 @@ def run_mq_bot(chatbot_name: str, vhost: str = '/chatbots', @param init_kwargs: extra kwargs to pass to chatbot `__init__` method @returns: Started ChatBotV2 instance """ - from neon_utils.log_utils import LOG, init_log + from neon_utils.log_utils import init_log init_log({"level_overrides": {"error": ['pika'], "warning": ["filelock"]}}) os.environ['CHATBOT_VERSION'] = 'v2' diff --git a/chatbot_core/utils/logger.py b/chatbot_core/utils/logger.py index b84c009..af7f9d5 100644 --- a/chatbot_core/utils/logger.py +++ b/chatbot_core/utils/logger.py @@ -17,20 +17,23 @@ # US Patents 2008-2021: US7424516, US20140161250, US20140177813, US8638908, US8068604, US8553852, US10530923, US10530924 # China Patent: CN102017585 - Europe Patent: EU2156652 - Patents Pending -import logging +from ovos_utils.log import LOG +LOG.name = "chatbots" # fmt = '%(asctime)s - %(levelname)-8s - %(name)s:%(filename)s:%(module)s:%(funcName)s:%(lineno)d - %(message)s' # logging.basicConfig(level=logging.DEBUG, format=fmt, datefmt='%Y-%m-%d:%H:%M:%S') -LOG = logging.getLogger("chatbots") +# LOG = logging.getLogger("chatbots") # logging.getLogger("socketio.client").setLevel(logging.WARNING) # logging.getLogger("engineio.client").setLevel(logging.WARNING) # logging.getLogger("urllib3").setLevel(logging.WARNING) -def make_logger(name, level=logging.DEBUG): +def make_logger(name, level=None): """ Create a logger with the specified name (used to create bot loggers) """ + import logging + level = level or logging.DEBUG logger = logging.getLogger(name) logger.setLevel(level) return logging.getLogger(name)