MCPcopy Create free account
hub / github.com/OpenBMB/ChatDev / LogManager

Class LogManager

utils/log_manager.py:15–215  ·  view source on GitHub ↗

Backward-compatible wrapper that delegates to ``WorkflowLogger``.

Source from the content-addressed store, hash-verified

13
14
15class LogManager:
16 """Backward-compatible wrapper that delegates to ``WorkflowLogger``."""
17
18 def __init__(self, logger: WorkflowLogger = None):
19 self.logger = logger
20
21 def get_logger(self) -> WorkflowLogger:
22 """Return the underlying ``WorkflowLogger`` instance."""
23 return self.logger
24
25 # ================================================================
26 # Timer context managers delegated to WorkflowLogger
27 # ================================================================
28
29 @contextmanager
30 def node_timer(self, node_id: str):
31 """Context manager that times node execution."""
32 with self.logger.node_timer(node_id):
33 yield
34
35 @contextmanager
36 def model_timer(self, node_id: str):
37 """Context manager that times model invocations."""
38 with self.logger.model_timer(node_id):
39 yield
40
41 @contextmanager
42 def agent_timer(self, node_id: str):
43 """Context manager that times agent invocations."""
44 with self.logger.agent_timer(node_id):
45 yield
46
47 @contextmanager
48 def human_timer(self, node_id: str):
49 """Context manager that times human interactions."""
50 with self.logger.human_timer(node_id):
51 yield
52
53 @contextmanager
54 def tool_timer(self, node_id: str, tool_name: str):
55 """Context manager that times tool invocations."""
56 with self.logger.tool_timer(node_id, tool_name):
57 yield
58
59 @contextmanager
60 def thinking_timer(self, node_id: str, stage: str):
61 """Context manager that times thinking workflows."""
62 with self.logger.thinking_timer(node_id, stage):
63 yield
64
65 @contextmanager
66 def memory_timer(self, node_id: str, operation_type: str, stage: str):
67 """Context manager that times memory operations."""
68 with self.logger.memory_timer(node_id, operation_type, stage):
69 yield
70
71 @contextmanager
72 def operation_timer(self, operation_name: str):

Callers 1

buildMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected