pub struct Builder { /* private fields */ }Implementations§
Source§impl Builder
impl Builder
pub fn new() -> Self
pub fn rotation_strategy(self, rotation_strategy: RotationStrategy) -> Self
pub fn timezone_strategy(self, timezone_strategy: TimezoneStrategy) -> Self
pub fn max_file_size(self, max_file_size: u128) -> Self
pub fn format<F>(self, formatter: F) -> Self
pub fn level(self, level_filter: impl Into<LevelFilter>) -> Self
pub fn level_for( self, module: impl Into<Cow<'static, str>>, level: LevelFilter, ) -> Self
pub fn filter<F>(self, filter: F) -> Self
Sourcepub fn clear_targets(self) -> Self
pub fn clear_targets(self) -> Self
Removes all targets. Useful to ignore the default targets and reconfigure them.
Sourcepub fn target(self, target: Target) -> Self
pub fn target(self, target: Target) -> Self
Adds a log target to the logger.
use tauri_plugin_log::{Target, TargetKind};
tauri_plugin_log::Builder::new()
.target(Target::new(TargetKind::Webview));Sourcepub fn skip_logger(self) -> Self
pub fn skip_logger(self) -> Self
Skip the creation and global registration of a logger
If you wish to use your own global logger, you must call skip_logger so that the plugin does not attempt to set a second global logger. In this configuration, no logger will be created and the plugin’s log command will rely on the result of log::logger(). You will be responsible for configuring the logger yourself and any included targets will be ignored. This can also be used with tracing-log or if running tests in parallel that require the plugin to be registered.
static LOGGER: SimpleLogger = SimpleLogger;
log::set_logger(&SimpleLogger)?;
log::set_max_level(LevelFilter::Info);
tauri_plugin_log::Builder::new()
.skip_logger();Sourcepub fn targets(self, targets: impl IntoIterator<Item = Target>) -> Self
pub fn targets(self, targets: impl IntoIterator<Item = Target>) -> Self
Adds a collection of targets to the logger.
use tauri_plugin_log::{Target, TargetKind, WEBVIEW_TARGET};
tauri_plugin_log::Builder::new()
.clear_targets()
.targets([
Target::new(TargetKind::Webview),
Target::new(TargetKind::LogDir { file_name: Some("webview".into()) }).filter(|metadata| metadata.target().starts_with(WEBVIEW_TARGET)),
Target::new(TargetKind::LogDir { file_name: Some("rust".into()) }).filter(|metadata| !metadata.target().starts_with(WEBVIEW_TARGET)),
]);pub fn split<R: Runtime>( self, app_handle: &AppHandle<R>, ) -> Result<(TauriPlugin<R>, LevelFilter, Box<dyn Log>), Error>
pub fn build<R: Runtime>(self) -> TauriPlugin<R>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl !RefUnwindSafe for Builder
impl Send for Builder
impl !Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more