Commit 874f6bf
fix(runi-log): write logs to stderr (#17)
## Summary
- `init_with_env` uses `IsTerminal` on stderr to choose human vs JSON
format, but `fmt::layer()` defaults to **stdout** — so a `2>log`
redirect would ship JSON to stdout while the TTY check still saw a
terminal.
- Pin all three layers (`init_with_env` TTY, `init_with_env` non-TTY,
`init_with_level`) to `std::io::stderr` so the writer and the terminal
check agree, and match the usual CLI convention of logs-on-stderr.
## Test plan
- [x] `cargo build -p runi-log --all-targets`
- [x] `cargo test -p runi-log`
- [x] `cargo clippy -p runi-log --all-targets -- -D warnings`
- [x] `cargo fmt --all -- --check`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent aa25dbd commit 874f6bf
1 file changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| 40 | + | |
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
| |||
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
49 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
50 | 59 | | |
51 | 60 | | |
52 | 61 | | |
| |||
0 commit comments