From be5aebdec9f14c5c82b1050f2096dfcdcbf5a853 Mon Sep 17 00:00:00 2001 From: lopo <59609929+lopo12123@users.noreply.github.com> Date: Mon, 1 Jan 2024 19:24:41 +0800 Subject: [PATCH] docs(log): update readme code example for v2 (#869) --- plugins/log/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/log/README.md b/plugins/log/README.md index b92e4aca..f8ecdb2a 100644 --- a/plugins/log/README.md +++ b/plugins/log/README.md @@ -49,14 +49,14 @@ First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` ```rust -use tauri_plugin_log::{LogTarget}; +use tauri_plugin_log::{Target, TargetKind}; fn main() { tauri::Builder::default() - .plugin(tauri_plugin_log::Builder::default().targets([ - LogTarget::LogDir, - LogTarget::Stdout, - LogTarget::Webview, + .plugin(tauri_plugin_log::Builder::new().targets([ + Target::new(TargetKind::Stdout), + Target::new(TargetKind::LogDir { file_name: None }), + Target::new(TargetKind::Webview), ]).build()) .run(tauri::generate_context!()) .expect("error while running tauri application"); @@ -68,7 +68,7 @@ Afterwards all the plugin's APIs are available through the JavaScript guest bind ```javascript import { trace, info, error, attachConsole } from "@tauri-apps/plugin-log"; -// with LogTarget::Webview enabled this function will print logs to the browser console +// with TargetKind::Webview enabled this function will print logs to the browser console const detach = await attachConsole(); trace("Trace");