Peekaboo Logging Guide
#Overview
The CLI logger writes timestamped diagnostic messages to stderr in text mode and buffers the same messages for debug_logs in JSON mode. It supports free-form categories and key/value metadata.
#Log Levels
Peekaboo supports these levels from most to least verbose:
- TRACE
- VERBOSE
- DEBUG
- INFO
- WARN
- ERROR
- CRITICAL
The default minimum is warning unless PEEKABOO_LOG_LEVEL overrides it.
#Enabling Verbose Logging
#Command Line Flag
Use --verbose or -v on commands that expose the global runtime options:
peekaboo see --app Safari --verbose
peekaboo click --on "$ELEMENT_ID" --verbose
#Environment Variable
PEEKABOO_LOG_LEVEL=debug peekaboo see --app Safari
Accepted values are trace, verbose, debug, info, warning/warn, error, and critical.
#Log Output Format
The CLI logger formats text as:
[2026-08-08T12:34:56.789Z] VERBOSE: Message
[2026-08-08T12:34:56.789Z] VERBOSE [Capture]: Message {app=Safari, mode=window}
The timestamp is ISO 8601 with fractional seconds. Category and metadata are optional. Metadata ordering is not an API contract because it comes from a Swift dictionary.
#Log Categories
Categories are strings supplied by call sites rather than a central enum. Current CLI code uses categories including AI, Automation, Bridge, Capture, Commander, Menu, MultiScreen, Operation, and Performance.
The separate automation event logger uses Apple's unified logging for command activity; it does not change the stderr/JSON format above.
Detached native AX observations have a debug-only unified-log category, AXObservation, under boo.peekaboo.core. Capture it for the executing CLI or Bridge host while reproducing a slow or incomplete read:
log stream --level debug --predicate 'processIdentifier == 12345 AND subsystem == "boo.peekaboo.core" AND category == "AXObservation"'
Replace 12345 with the verified executing host PID. These records report native call type, traversal-node ordinal, elapsed milliseconds, raw AX errors, fixed attribute names for embedded errors, batch counts/fallbacks, and total worker time. Node zero denotes reads outside traversal. Fast successful reads are omitted; calls taking at least 50 ms and failed/fallback reads are retained. No UI values, labels, identifiers or action names are logged, and no additional AX queries are performed. This stream is separate from CLI debug_logs; it does not require a private-data logging profile.
#Performance Tracking
Logger.startTimer(_:) records a start time. stopTimer(_:threshold:) prepares a Performance message when verbose mode is active or a supplied threshold is exceeded; the configured minimum level still controls whether that verbose message is emitted:
[2026-08-08T12:34:56.789Z] VERBOSE [Performance]: Starting timer 'screen_capture'
[2026-08-08T12:34:57.122Z] VERBOSE [Performance]: Timer 'screen_capture' completed {duration_ms=333}
operationStart and operationComplete wrap this timer behavior and add Operation metadata.
#JSON Output Mode
When a command enables JSON output, the logger buffers messages instead of writing them beside the JSON document. Standard CLI response types include those buffered strings in debug_logs:
{
"success": true,
"data": {},
"debug_logs": []
}
--json-output does not automatically lower the log threshold. Combine it with --verbose or PEEKABOO_LOG_LEVEL when detailed buffered logs are needed.
#Best Practices
- Use verbose or debug logging while reproducing automation failures.
- Add a category only when it helps isolate an owning subsystem.
- Keep metadata small and non-sensitive; it is printed in text mode and returned in JSON mode.
- Use timers for measured operations, not as a substitute for profiling.
#Integration with Other Tools
#Filtering Logs
peekaboo see --verbose 2>&1 | rg 'Performance'
peekaboo see --verbose 2>peekaboo.log
For JSON output, inspect .debug_logs instead of mixing diagnostics into stdout:
peekaboo see --app Safari --json-output --verbose | jq '.debug_logs'
#Troubleshooting
#No Verbose Output
- Confirm the command accepts
--verbose, or setPEEKABOO_LOG_LEVEL=verbose. - In text mode, check stderr rather than stdout.
- In JSON mode, inspect
debug_logs.