docs(log): update readme code example for v2 (#869)

pull/834/head
lopo 1 year ago committed by GitHub
parent b9d29a0154
commit be5aebdec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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");

Loading…
Cancel
Save