Skip to content

Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI

Update instrument_logging.py (#1150)

Harikrishnan Kefdd60506174
diff --git a/agentops/logging/instrument_logging.py b/agentops/logging/instrument_logging.py
index 472fa2fb..6b75abbf 100644
--- a/agentops/logging/instrument_logging.py
+++ b/agentops/logging/instrument_logging.py
@@ -9,6 +9,7 @@ _original_print = builtins.print
# Global buffer to store logs
_log_buffer = StringIO()
+print_logger = None
def setup_print_logger() -> None:
"""
@@ -28,7 +29,8 @@ def setup_print_logger() -> None:
# Ensure the new logger doesn't propagate to root
buffer_logger.propagate = False
-
+
+ global print_logger
def print_logger(*args: Any, **kwargs: Any) -> None:
"""
Custom print function that logs to buffer and console.