Skip to content

Commit a9630a1

Browse files
authored
Merge pull request #11 from iCog-Labs-Dev/feature/logger
[ENH] Reverted logging back to using metta-bin directory
2 parents b239b83 + d05f137 commit a9630a1

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

metta-run/src/tools/logger.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::env;
33
use std::fs::OpenOptions;
44
use std::io::Write;
55
use std::time::Instant;
6-
use std::env::current_dir;
76

87
pub fn start_timer() -> Instant {
98
Instant::now()
@@ -13,15 +12,11 @@ pub fn stop_timer(start_time: Instant, metta_output: &String) -> Result<(), std:
1312
let now = Local::now();
1413
let formatted_date = now.format("%Y-%m-%d").to_string();
1514

16-
17-
let file_path: Option<String> = match current_dir() {
18-
Ok(path) => Some(path.to_string_lossy().into_owned()),
19-
Err(error) => None
20-
};
21-
let log_file_name = match file_path {
22-
Some(path) => format!("{}/{}.log", path, formatted_date),
23-
None => todo!()
24-
};
15+
let log_file_name = format!(
16+
"{}/metta-bin/{}.log",
17+
env::var("HOME").unwrap(),
18+
formatted_date
19+
);
2520

2621
let end_time = Instant::now();
2722
let elapsed_time = end_time.duration_since(start_time);

0 commit comments

Comments
 (0)