Expand description
Local tracing init (stderr + optional XDG rotated JSON; no remote export). Local-only tracing init for the one-shot CLI (rules_rust_logs_com_tracing_e_rotacao).
§Product law
- No remote telemetry: no OpenTelemetry, OTLP, Sentry, or log shipping.
- stderr by default: agent pipelines keep stdout for JSON envelopes.
- Optional XDG file:
config set log_to_file truewrites rotated JSON under$XDG_STATE_HOME/browser-automation-cli/log/(never cloud). - No
RUST_LOGproduct path: filter comes from argv (-q/-v/--debug) or XDGlog_level(defaulterror). - Daemon-only rules N/A:
reload::Layeradmin HTTP, OTEL sampling, journald, Lambda flush, encrypted-at-rest pipelines — not applicable to BORN→DIE.
§Targets emitted
Prefer browser_automation_cli::<module> (crate name with underscores). The
telemetry module itself logs browser_automation_cli::telemetry on successful init.
§Lifecycle
[init_telemetry] installs the global subscriber once (from crate::run) and
returns a [TelemetryGuard]. When file logging is enabled, the guard owns a
tracing_appender [WorkerGuard] so buffered lines flush on drop at process end.
Hold the guard until FINALIZE completes — do not mem::forget it.
Structs§
- Telemetry
Guard - Process-scoped telemetry handle. Drop flushes the optional non-blocking file worker.
- Telemetry
Opts - Inputs for local tracing (mirrors CLI globals + XDG).
Constants§
- LOG_
FILE_ PREFIX - Filename prefix for rotated logs (
browser-automation-cli.YYYY-MM-DD). - MAX_
LOG_ FILES - Maximum retained daily log files under XDG state (retention ≈ 2 weeks).
Functions§
- init_
telemetry - Install the global tracing subscriber (once) and return a process-lifetime guard.
- resolve_
filter_ directive - Resolve the EnvFilter directive string (testable pure function).