Skip to content

Commit

Permalink
collect: format date in UTC if requested
Browse files Browse the repository at this point in the history
Signed-off-by: Antoine Tenart <[email protected]>
  • Loading branch information
atenart committed Jun 26, 2024
1 parent 98d0154 commit d18a261
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions retis/src/collect/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ defaults to \"retis.data\"."
#[arg(long, help = "Format used when printing an event.")]
#[clap(value_enum, default_value_t=CliDisplayFormatFlavor::MultiLine)]
pub(super) format: CliDisplayFormatFlavor,
#[arg(long, help = "Time format used when printing an event.")]
#[clap(value_enum, default_value_t=CliTimeFormat::MonotonicTimestamp)]
pub(super) time_format: CliTimeFormat,
#[arg(
id = "filter-packet",
short,
Expand Down
6 changes: 5 additions & 1 deletion retis/src/collect/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,13 @@ impl Collectors {
// Write events to stdout if we don't write to a file (--out) or if
// explicitly asked to (--print).
if collect.out.is_none() || collect.print {
let mut format = DisplayFormat::new(collect.format.into());
format.set_time_format(collect.time_format.into());
format.set_monotonic_offset(monotonic_clock_offset()?);

printers.push(PrintSingle::new(
Box::new(io::stdout()),
PrintSingleFormat::Text(DisplayFormat::new(collect.format.into())),
PrintSingleFormat::Text(format),
));
}

Expand Down

0 comments on commit d18a261

Please sign in to comment.