mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-21 11:26:15 +02:00
docs(log): update readme code example for v2 (#869)
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user