effective logger#1260
Conversation
|
Greptile OverviewGreptile SummaryThis PR systematically replaces inconsistent logging practices ( Key Changes
All error logs now include structured auxiliary data with error messages, stack traces, and relevant context for better debuggability. Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Handler as v3CuaAgentHandler
participant Client as AgentClient (Anthropic/Google/OpenAI)
participant Action as Action Methods
participant Screenshot as captureScreenshot
participant Logger as Structured Logger
Handler->>Client: execute(options)
Note over Handler,Client: Pass logger to client
Client->>Action: getAction(inputItems, logger)
Note over Action: Was: console.error()<br/>Now: logger({category, message, level})
Action-->>Logger: Log errors with stack trace
Action-->>Logger: Log warnings with context
Client->>Action: convertToolUseToAction(item, logger)
Note over Action: Convert tool calls to actions
Action-->>Logger: Log unknown tools, missing actions
Client->>Screenshot: captureScreenshot(logger, options)
Note over Screenshot: First param is now logger
Screenshot-->>Logger: Log screenshot errors
Handler->>Client: captureScreenshot(this.logger, {...})
Note over Handler,Client: Handler passes its logger instance
|
|
@filip-michalsky check out the changes from #1283 hopefully it covers all your logging needs. export BROWSERBASE_CONFIG_DIR=~/.config/browserbase # set this in env / ~/.zshrc / ~/.bashrc
# example usage:
tsx run_any_script_that_imports_stagehand.ts
tail -f ~/.config/browserbase/sessions/latest/*.log # follow all events in realtime
tail -f ~/.config/browserbase/sessions/latest/llm_events.log # follow only LLM events
cat ~/.config/browserbase/sessions/latest/*.log | sort # full output in chronological orderIf you prefer not to persist logs you can also set |
Why
Improved logging consistency and debuggability across the Stagehand codebase (STG-907). The codebase had inconsistent logging practices with many
console.log, console.error, and console.warn calls that weren't properly integrated with Stagehand's logging system. Additionally, several silent
error catches made debugging difficult.
What Changed
Agent Clients (Anthropic, Google, OpenAI CUA)
Error Handling Improvements
Debugging Improvements
AI SDK Client
Eval Tasks
Test Plan