tauri-apps / tauri-apps/plugins-workspace

[v2][log] TargetKind::LogDir not working on mobile

Open
#1,257 0 comments 0 reactions 0 assignees View on GitHub
platform: android platform: ios plugin: log type: bug
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

Hi guys, first of all, thanks for the amazing tauri v2 works.

It seems, the logfile is not set when running on a mobile platform.

plugins/log/src/lib.rs:

```
#[cfg(mobile)]
TargetKind::LogDir { .. } => continue,
#[cfg(desktop)]
TargetKind::LogDir { file_name } => {
let path = app_handle.path().app_log_dir().unwrap();
if !path.exists() {
fs::create_dir_all(&path).unwrap();
}
fern::log_file(get_log_file_path(
&path,
file_name.as_deref().unwrap_or(app_name),
&self.rotation_strategy,
&self.timezone_strategy,
self.max_file_size,
)?)?
.into()
}
```
From my understanding a #[cfg(any(desktop, mobile)] would be sufficient as the app_log_dir() function is already implemented for mobile.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.