From 5f6b4b3bf3018597930ef36dae643e5893010ca2 Mon Sep 17 00:00:00 2001 From: Akmot9 Date: Mon, 7 Aug 2023 23:56:39 +0200 Subject: [PATCH] it diplays the logs in the cli --- .gitignore | 2 ++ file.log | 16 +--------------- src/logger.rs | 1 + 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 6985cf1..6fffce8 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb + +*.log \ No newline at end of file diff --git a/file.log b/file.log index a89a4d5..7020411 100644 --- a/file.log +++ b/file.log @@ -1,16 +1,2 @@ -[2023-08-06 22:24:36.414999818 UTC] Test message 1 - -[2023-08-06 22:24:36.415110458 UTC] Test message 2 - -[2023-08-06 22:24:36.714024987 UTC] This is a log message. - -[2023-08-06 22:24:36.714163469 UTC] Another log message with a value: 42 - -[2023-08-06 22:24:36.741582353 UTC] This is a log message. - -[2023-08-06 22:24:36.741726988 UTC] Another log message with a value: 42 - -[2023-08-06 22:24:36.745424388 UTC] This is a log message. - -[2023-08-06 22:24:36.745496464 UTC] Another log message with a value: 42 +[2023-08-07 21:55:28.310429743 UTC] error: Something went wrong! diff --git a/src/logger.rs b/src/logger.rs index 1f90e7f..e48e936 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -24,6 +24,7 @@ macro_rules! log { let log_message = format!($($arg)*); let now = Utc::now(); let log_line = format!("[{}] {}\n", now, log_message); + println!("{log_line}"); if let Ok(mut file) = OpenOptions::new() .append(true)