Skip to content

Commit 25f8d0e

Browse files
committed
Add first debug messages
1 parent 761c6b4 commit 25f8d0e

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/logging.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ pub fn initialize_logger(verbose: bool, quiet: bool) {
1616
};
1717

1818
let config = ConfigBuilder::new()
19-
// Display a time stamp only for the debug and more verbose levels.
20-
.set_time_level(LevelFilter::Debug)
19+
// Display a time stamp only for the most verbose level.
20+
.set_time_level(LevelFilter::Trace)
2121
.build();
2222

2323
TermLogger::init(

src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use log::info;
1+
use log::{debug, info};
22

33
mod cmd_line;
44
mod logging;
@@ -53,6 +53,8 @@ fn main() {
5353
detect_directory: true,
5454
};
5555

56+
debug!("Active options:\n{:#?}", &options);
57+
5658
// Store all modules except for the populated assembly that will be created in this Vec
5759
let mut non_populated: Vec<Module> = Vec::new();
5860

src/write.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fs;
22
use std::io;
33
use std::path::PathBuf;
44

5-
use log::{error, info, warn};
5+
use log::{debug, error, info, warn};
66

77
use crate::module::Module;
88
use crate::Options;
@@ -14,6 +14,8 @@ impl Module {
1414
let full_path_buf: PathBuf = [&options.target_dir, &self.file_name].iter().collect();
1515
let full_path = full_path_buf.as_path();
1616

17+
debug!("Writing file: {}", &full_path.display());
18+
1719
// If the target file already exists, just print out an error
1820
if full_path.exists() {
1921
// A prompt enabling the user to overwrite the existing file
@@ -24,7 +26,7 @@ impl Module {
2426

2527
io::stdin()
2628
.read_line(&mut answer)
27-
.expect("Failed to read the response");
29+
.expect("Failed to read your response");
2830

2931
match answer.trim().to_lowercase().as_str() {
3032
"y" | "yes" => {
@@ -49,7 +51,7 @@ impl Module {
4951
}
5052
// If the write fails, print why it failed
5153
Err(e) => {
52-
error!("Failed to write the file: {}", e);
54+
error!("Failed to write the `{}` file: {}", &full_path.display(), e);
5355
}
5456
}
5557
}

0 commit comments

Comments
 (0)