Skip to content

Commit

Permalink
Update log init to handle configured log level
Browse files Browse the repository at this point in the history
Update logger module to mark `LOG` reference as deprecated
  • Loading branch information
NeonDaniel committed Jan 16, 2025
1 parent d2ac7f3 commit 3da3d30
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions chatbot_core/chatbot_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def log(self):
# Copy log to support multiple bots in thread with different names
self.__log = init_log(
log_name="chatbots").create_logger(self._bot_id)
self.__log.level = LOG.level
LOG.info(f"Initialized logger with level: {LOG.level}")
name = f"{self._bot_id} - "
stack = inspect.stack()
record = stack[2]
Expand Down
14 changes: 12 additions & 2 deletions chatbot_core/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,18 @@
# US Patents 2008-2021: US7424516, US20140161250, US20140177813, US8638908, US8068604, US8553852, US10530923, US10530924
# China Patent: CN102017585 - Europe Patent: EU2156652 - Patents Pending

from ovos_utils.log import LOG, log_deprecation
LOG.name = "chatbots"

from neon_utils.decorators import module_property
from ovos_utils.log import log_deprecation, deprecated


@deprecated(deprecation_version="3.0.0",
log_message="Import from `ovos_utils.log` directly")
@module_property
def LOG():
from ovos_utils.log import LOG
LOG.name = "chatbots"
return LOG


def make_logger(name, level: str = None):
Expand Down

0 comments on commit 3da3d30

Please sign in to comment.