Skip to content

Commit 50810c3

Browse files
committed
🔧 Require explicit --log flag or verbose env var for stdout logging
Change logging initialization to write to files by default without spamming stdout. Both --log CLI flag and GIT_IRIS_VERBOSE enable stdout output explicitly, while file logging remains enabled by default. This keeps normal command output clean while providing multiple ways to enable debug output when needed.
1 parent c87731d commit 50810c3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ pub async fn main() -> anyhow::Result<()> {
409409

410410
if cli.log {
411411
crate::logger::enable_logging();
412+
crate::logger::set_log_to_stdout(true);
412413
let log_file = cli.log_file.as_deref().unwrap_or(LOG_FILE);
413414
crate::logger::set_log_file(log_file)?;
414415
log_debug!("Debug logging enabled");

src/logger.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,21 @@ pub fn init() -> Result<(), Box<dyn std::error::Error>> {
143143

144144
if verbose_from_env {
145145
set_verbose_logging(true);
146+
set_log_to_stdout(true);
146147
}
147148

148-
// Enable logging by default
149+
// Enable logging to file only by default (stdout requires explicit --log flag)
149150
enable_logging();
150-
set_log_to_stdout(true);
151151

152152
// Set up tracing subscriber with unified writer (for Rig logs)
153+
// Default: only warnings/errors. Debug requires RUST_LOG or --log flag
153154
let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| {
154-
// Default filter: show git_iris and iris debug, rig info, and warnings from others
155-
"git_iris=debug,iris=debug,rig=info,warn".into()
155+
if verbose_from_env {
156+
"git_iris=debug,iris=debug,rig=info,warn".into()
157+
} else {
158+
// Silent by default - no debug spam
159+
"warn".into()
160+
}
156161
});
157162

158163
let fmt_layer = fmt::Layer::new()

0 commit comments

Comments
 (0)