Skip to content

Commit 539a8da

Browse files
cgzonesclaude
andcommitted
Show log timestamps by default; drop JOURNAL_STREAM auto-detection
An inherited JOURNAL_STREAM (systemd-managed terminals set it in every interactive shell) wrongly suppressed console timestamps. Honor only --skip-log-timestamp. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7660ebd commit 539a8da

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,8 @@ struct Cli {
595595
/// file (or the built-in default when no file is loaded)
596596
#[arg(long, value_name = "PATH")]
597597
database_path: Option<PathBuf>,
598-
/// Skip timestamp in log messages
598+
/// Skip timestamp in log messages (e.g. under systemd/journald, which
599+
/// prepends its own)
599600
#[arg(long, default_value = "false")]
600601
skip_log_timestamp: bool,
601602
/// Permit daemon running as root user (potentially dangerous)
@@ -830,8 +831,6 @@ fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
830831
.with_filter(tracing::level_filters::LevelFilter::WARN);
831832

832833
let skip_timestamp = args.skip_log_timestamp;
833-
// journald prepends its own timestamp
834-
let skip_stderr_timestamp = skip_timestamp || std::env::var_os("JOURNAL_STREAM").is_some();
835834
let output_thread_names = output_log_level >= tracing::level_filters::LevelFilter::DEBUG;
836835
let stderr_is_tty = std::io::stderr().is_terminal();
837836

@@ -843,7 +842,7 @@ fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
843842
.with_target(false)
844843
.with_thread_names(output_thread_names)
845844
.with_level(true);
846-
let layer = if skip_stderr_timestamp {
845+
let layer = if skip_timestamp {
847846
base.without_time().with_filter(output_log_level).boxed()
848847
} else {
849848
base.with_timer(UtcTimer)

0 commit comments

Comments
 (0)