Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Removes unecessary logging code from CLI

elijahbenizzy40b84ff95e79
diff --git a/burr/cli/__main__.py b/burr/cli/__main__.py
index 8607aa96..1d9ab69a 100644
--- a/burr/cli/__main__.py
+++ b/burr/cli/__main__.py
@@ -15,6 +15,7 @@ from types import ModuleType
from burr import system, telemetry
from burr.core.persistence import PersistedStateData
from burr.integrations.base import require_plugin
+from burr.log_setup import setup_logging
try:
import click
@@ -27,27 +28,8 @@ except ImportError as e:
"start",
)
-
-# Quick trick to use loguru for everything so it's all the same color
-class InterceptHandler(logging.Handler):
- def emit(self, record):
- # Get corresponding Loguru level if it exists
- try:
- level = logger.level(record.levelname).name
- except ValueError:
- level = record.levelno
-
- # Find caller from where originated the log message
- frame, depth = logging.currentframe(), 2
- while frame.f_code.co_filename == logging.__file__:
- frame = frame.f_back
- depth += 1
-
- logger.opt(depth=depth, exception=record.exc_info).log(level, record.getMessage())
-
-
# Clear default handlers
-logging.basicConfig(handlers=[InterceptHandler()], level=logging.INFO)
+setup_logging(logging.INFO)
# TODO -- add this as a general callback to the CLI
diff --git a/examples/streaming-fastapi/application.py b/examples/streaming-fastapi/application.py
index e8c4d48f..8e90df8e 100644
--- a/examples/streaming-fastapi/application.py
+++ b/examples/streaming-fastapi/application.py
@@ -173,7 +173,6 @@ def application(app_id: Optional[str] = None):
.with_entrypoint("prompt")
.with_state(chat_history=[])
.with_graph(graph)
- # .with_tracker(project="demo_chatbot_streaming")
.with_tracker(project="demo_chatbot_streaming")
.with_identifiers(app_id=app_id)
.build()