Skip to content

Commit

Permalink
Restore source path stem in json output filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
dgmcdona committed Dec 22, 2024
1 parent f67baa1 commit da16a37
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion examples/unifiedlog_parser_json/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,19 @@ fn parse_trace_file(
// We will try parsing them again at the end once we have all Oversize entries
missing_data.push(missing_logs);
log_count += results.len();
output(&results, &format!("persist_{}", i)).unwrap();

let filepath = PathBuf::from(source.source_path());
output(
&results,
&format!(
"persist_{}",
filepath
.file_stem()
.map(|stem| stem.to_string_lossy())
.unwrap_or_else(|| { format!("{}", i).into() })
),
)
.unwrap();
}

// Include all log entries now, if any logs are missing data its because the data has rolled
Expand Down

0 comments on commit da16a37

Please sign in to comment.