Files
Laszlo NagyandClaude Opus 4.8 c29e41ca0e feat(logging): unify diagnostics into user and developer formats
Bear's log output serves two readers, and one format could not serve
both. A user running a build wants terse, program-prefixed messages like
every other UNIX tool; a developer debugging Bear wants a rich trace that
tells apart the driver, wrapper, and preload processes as their lines
interleave on one terminal.

The old code had three divergent init sites: the driver used env_logger's
default format, which tags each line with the Rust module path rather than
the process, so a single process spanning many crates was mislabelled;
the wrapper and preload each hand-rolled a timestamped format with
duplicated epoch math.

Replace all three with one shared initializer in the intercept crate
(the only dependency common to every binary). It picks a format from the
environment: unset RUST_LOG gives the UNIX user view "prog: message" on
stderr with warning:/error: qualifiers; a set RUST_LOG gives the developer
view tagging every line with a timestamp, level, process identity plus
pid, and source module. Process identities are stable: bear, wrapper,
preload.

Behavior change worth noting for release: the wrapper and preload
previously had no explicit default filter (effectively error level); they
now default to warn like the driver, so a rare preload warning (non-UTF-8
popen/system command, or a double-init guard) can reach an intercepted
compiler's stderr. This is intentional per the new contract.

Governed by the new requirement cli-diagnostic-format, verified by unit
tests on the format helpers and integration tests on the format switch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 10:59:07 +00:00

32 lines
711 B
TOML

# SPDX-License-Identifier: GPL-3.0-or-later
[package]
name = "intercept"
description = "Shared interception runtime for Bear (reporter, collector, wrapper, environment)."
version.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
license.workspace = true
edition.workspace = true
[lib]
name = "intercept"
path = "src/lib.rs"
[dependencies]
thiserror.workspace = true
serde.workspace = true
serde_json.workspace = true
log.workspace = true
env_logger.workspace = true
[target.'cfg(unix)'.dependencies]
libc.workspace = true
[build-dependencies]
compilers-codegen = { path = "../../build-support/compilers-codegen" }
[dev-dependencies]
tempfile.workspace = true