Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
refactor(matrix): replace logging depth magic number
Alexander Mingesffac42f9e5d1
diff --git a/nanobot/channels/matrix.py b/nanobot/channels/matrix.pyindex d73a84930..63a07e06d 100644--- a/nanobot/channels/matrix.py+++ b/nanobot/channels/matrix.py@@ -18,6 +18,8 @@ from nanobot.bus.events import OutboundMessagefrom nanobot.channels.base import BaseChannelfrom nanobot.config.loader import get_data_dir+LOGGING_STACK_BASE_DEPTH = 2+class _NioLoguruHandler(logging.Handler):"""Route stdlib logging records from matrix-nio into Loguru output."""@@ -29,7 +31,8 @@ class _NioLoguruHandler(logging.Handler):level = record.levelnoframe = logging.currentframe()- depth = 2+ # Skip logging internals plus this handler frame when forwarding to Loguru.+ depth = LOGGING_STACK_BASE_DEPTHwhile frame and frame.f_code.co_filename == logging.__file__:frame = frame.f_backdepth += 1