Skip to content

Commit 3da3d30

Browse files
committed
Update log init to handle configured log level
Update logger module to mark `LOG` reference as deprecated
1 parent d2ac7f3 commit 3da3d30

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

chatbot_core/chatbot_abc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def log(self):
5151
# Copy log to support multiple bots in thread with different names
5252
self.__log = init_log(
5353
log_name="chatbots").create_logger(self._bot_id)
54+
self.__log.level = LOG.level
55+
LOG.info(f"Initialized logger with level: {LOG.level}")
5456
name = f"{self._bot_id} - "
5557
stack = inspect.stack()
5658
record = stack[2]

chatbot_core/utils/logger.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,18 @@
1717
# US Patents 2008-2021: US7424516, US20140161250, US20140177813, US8638908, US8068604, US8553852, US10530923, US10530924
1818
# China Patent: CN102017585 - Europe Patent: EU2156652 - Patents Pending
1919

20-
from ovos_utils.log import LOG, log_deprecation
21-
LOG.name = "chatbots"
20+
21+
from neon_utils.decorators import module_property
22+
from ovos_utils.log import log_deprecation, deprecated
23+
24+
25+
@deprecated(deprecation_version="3.0.0",
26+
log_message="Import from `ovos_utils.log` directly")
27+
@module_property
28+
def LOG():
29+
from ovos_utils.log import LOG
30+
LOG.name = "chatbots"
31+
return LOG
2232

2333

2434
def make_logger(name, level: str = None):

0 commit comments

Comments
 (0)