Expand description
Structured tracing categories + log/tracing bridge installer (FR-65, FR-69 of Gitway PRD §5.8.4).
Anvil emits tracing::*! events with per-category target strings
so a consumer (Gitway’s CLI, downstream tooling, integration tests)
can install one [tracing_subscriber::EnvFilter] like
anvil_ssh::kex=trace,anvil_ssh::auth=debug and get exactly the
depth they want in each category — without parsing message text.
The categories are stable strings exported here so call sites at
anvil_ssh::session, anvil_ssh::auth, etc. stay typo-free, and
a downstream --debug-categories=kex,auth flag can validate user
input against CATEGORIES cheaply.
§Bridging existing log!() calls
Anvil 0.5.x and its dependencies (russh, ssh-key) emit via the
log crate. M15.1 introduces the install_log_bridge entry
point that funnels every log::*! call through the active
tracing subscriber, so a consumer who installs a single
tracing-subscriber sees both the new structured events AND the
~59 legacy log::*! call sites without rewriting them. The
migration to native tracing::*! calls inside Anvil is post-1.0
housekeeping; the bridge stays in place permanently for russh
and other reverse-deps that stay on log.
Anvil never installs a subscriber itself — the library cannot know whether the consumer wants human-formatted, JSONL, file-rotated, or OTLP output. See the Gitway CLI for the reference subscriber install (M15.4).
§Example
// Once, at process startup, BEFORE any `log::*!` or `tracing::*!`
// call is made (so clap-emitted parse errors aren't lost):
anvil_ssh::log::install_log_bridge().expect("bridge already installed?");
// Then install your tracing subscriber...
// tracing_subscriber::fmt().init();Constants§
- CATEGORIES
- All Anvil-defined categories, in declaration order. Used by
downstream CLIs (e.g. Gitway’s
--debug-categoriesflag) to validate user-supplied category names before building anEnvFilter. Does not includerussh— that’s a synthetic passthrough recognized by the consumer’s filter, not an Anvil category. - CAT_
AUTH target =string for the authentication category. Events at this target record every identity tried withpath,fp,alg, andverdict=accepted|rejectedstructured fields (FR-66).- CAT_
CHANNEL target =string for the channel + protocol-message category. Events at this target record every channelopen/closewith channel ID, plus every protocol message type and size (FR-66).- CAT_
CONFIG target =string for the~/.ssh/configresolver category. Events at this target record every directive applied with its sourcefileandlinenumber (FR-66).- CAT_KEX
target =string for the SSH key-exchange category. Events at this target dump offered + accepted KEX algorithms, ciphers, MACs, host-key algorithms, and compression algorithms (FR-66).- CAT_
RETRY target =string for the connection-retry / timeout category (M18, FR-83). Events at this target record each retry attempt withattempt,reason,elapsed_ms, and (on terminal failure) adispositionfield offatal/exhausted.
Functions§
- install_
log_ bridge - Installs the
log→tracingbridge.