From 96975ff488d282ae6cfc762356944c9a7450e2ae Mon Sep 17 00:00:00 2001 From: Philipp Temminghoff Date: Mon, 16 Dec 2024 20:36:49 +0100 Subject: [PATCH] chore: make showin logs in chat optional --- src/llmling_agent/cli/chat_session/session.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/llmling_agent/cli/chat_session/session.py b/src/llmling_agent/cli/chat_session/session.py index bc3797ca..ff3a4b7b 100644 --- a/src/llmling_agent/cli/chat_session/session.py +++ b/src/llmling_agent/cli/chat_session/session.py @@ -56,6 +56,7 @@ def __init__( agent: LLMlingAgent[str], *, log_level: int = logging.INFO, + show_log_in_chat: bool = False, stream: bool = False, ) -> None: """Initialize interactive session.""" @@ -71,10 +72,11 @@ def __init__( self.status_bar = StatusBar(self.console) # Setup logging - self._log_handler = SessionLogHandler(self._output_writer) - self._log_handler.setLevel(log_level) - logging.getLogger("llmling_agent").addHandler(self._log_handler) - logging.getLogger("llmling").addHandler(self._log_handler) + if show_log_in_chat: + self._log_handler = SessionLogHandler(self._output_writer) + self._log_handler.setLevel(log_level) + logging.getLogger("llmling_agent").addHandler(self._log_handler) + logging.getLogger("llmling").addHandler(self._log_handler) # Setup components self._setup_history()