Skip to content

Commit

Permalink
refactor: rename get_log_file -> get_log_filepath
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbrayo committed Feb 6, 2025
1 parent c42898f commit 95c9c07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ pub fn run() {
.reveal_item_in_dir(config_dir)
.expect("Failed to open config folder");
} else if event.id().0 == "log_folder" {
let log_path = logging::get_log_file();
let log_path = logging::get_log_filepath();
let log_dir = log_path.parent().unwrap_or(&log_path);
app.opener()
.reveal_item_in_dir(log_dir)
Expand Down
9 changes: 4 additions & 5 deletions src-tauri/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use log::LevelFilter;
use std::path::PathBuf;

pub fn setup_logging() -> Result<(), fern::InitError> {
let project_dirs =
ProjectDirs::from("net", "ActivityWatch", "Aw-Tauri").expect("Failed to get project dirs");
let log_path = project_dirs.data_dir().join("logs");
let log_path = get_log_filepath();
std::fs::create_dir_all(&log_path)?;
let log_file = log_path.join("aw-tauri.log");

Expand All @@ -16,7 +14,7 @@ pub fn setup_logging() -> Result<(), fern::InitError> {
.warn(Color::Yellow)
.info(Color::Green)
.debug(Color::Blue)
.trace(Color::White);
.trace(Color::BrightBlue);

// Base configuration
let base_config = fern::Dispatch::new()
Expand Down Expand Up @@ -51,7 +49,8 @@ pub fn setup_logging() -> Result<(), fern::InitError> {
Ok(())
}

pub fn get_log_file() -> PathBuf {
pub fn get_log_filepath() -> PathBuf {
// TODO: creates an aw-tauri folder in linux, move inside the legacy activitywatch folder
let project_dirs =
ProjectDirs::from("net", "ActivityWatch", "Aw-Tauri").expect("Failed to get project dirs");
project_dirs.data_dir().join("logs").join("aw-tauri.log")
Expand Down

0 comments on commit 95c9c07

Please sign in to comment.