# logging-consistency

## AUDIT (2026-02-01)

**Pattern:** `println!`/`eprintln!` usage instead of structured tracing
**Found:** 13 instances in 6 files

### Breakdown by Category

| Category | Count | Files | Decision |
|----------|-------|-------|----------|
| Doc comments | 8 | skeptic.rs (lens), skeptic.rs (query), lib.rs (query), lib.rs (storage), materializer.rs | KEEP - example code |
| CLI output | 5 | main.rs (sim) | KEEP - user-facing terminal output |
| Production code | 0 | - | N/A |

### Detailed Locations

**Doc Comments (Intentional - Example Code):**
- `crates/stemedb-lens/src/skeptic.rs:32` - `//!` example
- `crates/stemedb-lens/src/skeptic.rs:34` - `//!` example
- `crates/stemedb-query/src/skeptic.rs:27` - `//!` example
- `crates/stemedb-query/src/skeptic.rs:29` - `//!` example
- `crates/stemedb-query/src/lib.rs:41` - `//!` example
- `crates/stemedb-storage/src/lib.rs:112` - `//!` example
- `crates/stemedb-storage/src/lib.rs:115` - `//!` example
- `crates/stemedb-query/src/materializer.rs:75` - `///` example

**CLI Binary Output (Intentional - User Facing):**
- `crates/stemedb-sim/src/main.rs:32` - prints simulation summary
- `crates/stemedb-sim/src/main.rs:35` - prints PASSED message
- `crates/stemedb-sim/src/main.rs:38` - prints FAILED message
- `crates/stemedb-sim/src/main.rs:40` - prints error details
- `crates/stemedb-sim/src/main.rs:46` - prints fatal error

**Conclusion:** All instances are intentional. No production library code uses println.

## ENFORCE (2026-02-01)

Added clippy lints to prevent future `println!`/`eprintln!` in library code:

| File | Change |
|------|--------|
| `Cargo.toml` | Added `print_stdout = "warn"`, `print_stderr = "warn"` to `[workspace.lints.clippy]` |
| `crates/stemedb-sim/src/main.rs` | Added `#![allow(clippy::print_stdout, clippy::print_stderr)]` with comment explaining CLI exemption |

Verified: `cargo clippy --workspace -- -D warnings` passes.

## DOCUMENT (2026-02-01)

Added "Structured Logging" critical rule to CLAUDE.md:
> **Structured Logging:** Use `tracing` (info!, warn!, error!) instead of `println!`/`eprintln!`. Clippy enforces via `print_stdout`/`print_stderr` at warn level. CLI binaries (e.g., `stemedb-sim`) may use `#![allow()]` for user-facing output.

## COMPLETE (2026-02-01)

**Before:** 13 println!/eprintln! instances (all intentional)
**After:** 0 violations (8 in doc comments, 5 in CLI binary with allow attribute)

**Enforcement:**
- Workspace clippy lints: `print_stdout = "warn"`, `print_stderr = "warn"`
- CLI exemption pattern: `#![allow(clippy::print_stdout, clippy::print_stderr)]`

**Documentation:**
- CLAUDE.md Critical Rules: Added "Structured Logging" rule
