Skip to content

Commit

Permalink
fix: filter the logs inside tauri to reduce the amount of logs
Browse files Browse the repository at this point in the history
Signed-off-by: 1111mp <[email protected]>
  • Loading branch information
1111mp committed Nov 6, 2024
1 parent c0536dd commit e0a79be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"shell:allow-stdin-write",
"dialog:default",
"updater:default",
"window-state:default"
"window-state:default",
"log:default"
]
}
8 changes: 7 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn main() -> tauri::Result<()> {

#[cfg(not(debug_assertions))]
{
use tauri_plugin_log::{Builder, Target, TargetKind};
use tauri_plugin_log::{Builder, Target, TargetKind, TimezoneStrategy};

let log_plugin = Builder::default()
.rotation_strategy(tauri_plugin_log::RotationStrategy::KeepAll)
Expand All @@ -84,6 +84,12 @@ fn main() -> tauri::Result<()> {
Target::new(TargetKind::LogDir { file_name: None }),
// Target::new(TargetKind::Webview),
])
.timezone_strategy(TimezoneStrategy::UseLocal)
.level(log::LevelFilter::Info)
.filter(|metadata| {
let target = metadata.target();
target == "app" || target == "migrate"
})
.build();

builder = builder.plugin(log_plugin);
Expand Down

0 comments on commit e0a79be

Please sign in to comment.