Skip to content

Commit c73e360

Browse files
committed
fix: show "Logging to stdout" when using --stdout (fixes #2)
The startup message always showed the file path even when --stdout was used. Now it correctly prints "Logging to stdout" instead. Also moved the --stdout check out of the hot loop into a precomputed variable.
1 parent c76cb12 commit c73e360

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
100100
)
101101
})
102102
.unwrap_or(&default_file);
103-
println!("Logging to {}", file.display());
103+
let use_stdout = args.iter().any(|arg| arg == ARG_STDOUT);
104+
if use_stdout {
105+
eprintln!("Logging to stdout");
106+
} else {
107+
eprintln!("Logging to {}", file.display());
108+
}
104109

105110
// On GNOME Wayland, ensure the shell extension for active window detection is set up
106111
get_state::ensure_gnome_wayland_extension();
@@ -113,7 +118,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
113118
let current_time = Local::now();
114119
let state = get_state::get_state();
115120
if state != prev_state {
116-
if args.iter().any(|arg| arg == ARG_STDOUT) {
121+
if use_stdout {
117122
println!("{}", state.to_csv(&current_time));
118123
} else {
119124
write_csv::add_to_csv(file, &current_time, &state);

0 commit comments

Comments
 (0)