tauri-apps / tauri-apps/plugins-workspace
[Logger] Custom format API lacks date parameter causing missing timestamps in logs
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 602
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 9
Description
tauri_plugin_log::Builder::new()
.format(|out, message, record| {
out.finish(format_args!(
"[{} {}] {}",
record.level(),
record.target(),
message
))
})
.build()
When using the custom formatting function in the logging plugin (tauri-plugin-log), the callback parameters do not include a dateor timestampfield. This forces developers to manually generate timestamps within the format function, which:
1. Breaks consistency - Default log outputs include timestamps, but custom formats lose this unless re-implemented.
2. Increases complexity - Developers must write extra code to replicate basic functionality (e.g., new Date().toISOString()).
3. Causes formatting drift - Manually added timestamps may diverge from the plugin's native time handling (e.g., timezone alignment).
Expected Behavior
The format callback should expose a date: Dateor timestamp: numberparameter alongside existing fields like leveland args:
format: (out, { date, level, args }) => {
out.finish(`${date.toISOString()} [${level}] ${args.join(" ")}`)
}
Contributor guide
Assessment
This issue has not been assessed yet.