Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/content/docs/plugin/logging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,32 @@ tauri_plugin_log::Builder::new()
.build()
```

### Applying a different format to targets

You can specify your own log format for specific targets by using the `format` method
on `tauri_plugin_log::Target`. You may also wish to call `reset_format` on the builder
to remove the default formatter, which is applied to all targets:

```rust
tauri_plugin_log::Builder::new()
.reset_format()
.targets([
tauri_plugin_log::Target::new(
tauri_plugin_log::TargetKind::Stdout
)
.format(move |out, message, record| {
// custom formatter for stdout
}),
tauri_plugin_log::Target::new(
tauri_plugin_log::TargetKind::LogDir { file_name: None }
)
.format(move |out, message, record| {
// custom formatter for log files
}),
])
.build(),
```

#### Log dates

By default the log plugin uses the UTC timezone to format dates
Expand Down