plugins-workspace icon indicating copy to clipboard operation
plugins-workspace copied to clipboard

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

Open universalappfactory opened this issue 9 months ago • 0 comments

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.

universalappfactory avatar Apr 27 '24 06:04 universalappfactory