[v2][log]: Add generic fern::Dispatch TargetKind to log (#2600)

* [v2][log]: Add generic fern::Dispatch TargetKind to log

Original: https://github.com/tauri-apps/plugins-workspace/pull/1130/commits/b691382d1ea54733ca837995cfac9f82ea05f168

* Add change file

* clippy

---------

Co-authored-by: Tony <legendmastertony@gmail.com>
Co-authored-by: venkr <venkateshrameshkumar+1@gmail.com>
This commit is contained in:
TATSUNO “Taz” Yasuhiro
2025-04-07 10:13:17 +08:00
committed by GitHub
co-authored by Tony venkr
parent d1609913be
commit 9629c2f4f9
4 changed files with 14 additions and 3 deletions
+6
View File
@@ -0,0 +1,6 @@
---
log: minor
log-js: minor
---
Adds a new varient `TargetKind::Dispatch` that allows you to construct arbitrary log targets
+5
View File
@@ -170,6 +170,10 @@ pub enum TargetKind {
/// ///
/// This requires the webview to subscribe to log events, via this plugins `attachConsole` function. /// This requires the webview to subscribe to log events, via this plugins `attachConsole` function.
Webview, Webview,
/// Send logs to a [`fern::Dispatch`]
///
/// You can use this to construct arbitrary log targets.
Dispatch(fern::Dispatch),
} }
/// A log target. /// A log target.
@@ -481,6 +485,7 @@ impl Builder {
}); });
}) })
} }
TargetKind::Dispatch(dispatch) => dispatch.into(),
}; };
target_dispatch = target_dispatch.chain(logger); target_dispatch = target_dispatch.chain(logger);
@@ -355,10 +355,10 @@
"markdownDescription": "Denies the stdin_write command without any pre-configured scope." "markdownDescription": "Denies the stdin_write command without any pre-configured scope."
}, },
{ {
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n", "description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
"type": "string", "type": "string",
"const": "default", "const": "default",
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality without any specific\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`" "markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
} }
] ]
} }
+1 -1
View File
@@ -304,7 +304,7 @@ impl ShellScope<'_> {
.map(|s| { .map(|s| {
std::path::PathBuf::from(s) std::path::PathBuf::from(s)
.components() .components()
.last() .next_back()
.unwrap() .unwrap()
.as_os_str() .as_os_str()
.to_string_lossy() .to_string_lossy()