Skip to content

Commit

Permalink
0.1.3 pre-build.
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryMBaldwin committed Sep 24, 2024
1 parent bd150a5 commit e1c5e5b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions src-tauri/src/gui/pipe_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ pub async fn get_server_version() -> String {
_ => "Error: could not get server version".to_string()
}
}

// writes request to named pipe and waits for reponse, for check_alive()
async fn start_wait(request: &str) -> Result<String> {
let mut client = match PipeClient::connect(consts::PIPE_NAME) {
Expand Down
26 changes: 26 additions & 0 deletions src-tauri/src/server/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,30 @@ impl Logger {
date.format("%H:%M:%S").to_string()
}

//ensures that the /log/general/ directory exists and returns the path to the general log
pub fn get_general_log_path() -> String {
//get todays date
let date = Local::now();
let cache_dir = cache_dir().expect("Error getting cache dir");
let general_log_path = cache_dir.join(format!("stargazer/logs/general/{}.log", date.format("%m-%d-%y")));

//make sure logs/ and logs/general/ exist if they don't
if !general_log_path.exists() {
std::fs::create_dir_all(general_log_path.parent().unwrap()).expect("Error creating general log directory");
}
//create the file if it doesn't exist
if !general_log_path.exists() {
File::create(&general_log_path).expect("Error creating general log file");
}

general_log_path.to_str().unwrap().to_string()
}

//logs general message
pub fn log_general(&self, message: &str) -> () {
//ensure log exists
Self::get_general_log_path();
info!("[GENERAL]{}", message);
}

}
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}
},
"productName": "stargazer",
"version": "0.1.2",
"version": "0.1.3",
"identifier": "com.henrymbaldwin.stargazer",
"plugins": {
"updater": {
Expand Down

0 comments on commit e1c5e5b

Please sign in to comment.