Skip to content

Commit 592f00e

Browse files
committed
More debug messages
1 parent 25f8d0e commit 592f00e

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/module.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// This module defines the `Module` struct, its builder struct, and methods on both structs.
22
use std::path::{Path, PathBuf};
33

4+
use log::debug;
45
use regex::{Regex, RegexBuilder};
56

67
use crate::Options;
@@ -44,6 +45,8 @@ const REFERENCE_TEMPLATE: &str = include_str!("../data/templates/reference.adoc"
4445
/// Construct a basic builder for `Module`, storing information from the user input.
4546
impl Input {
4647
pub fn new(mod_type: ModuleType, title: &str, options: &Options) -> Input {
48+
debug!("Processing title `{}` of type `{:?}`", title, mod_type);
49+
4750
let title = String::from(title);
4851
let options = options.clone();
4952

@@ -326,15 +329,24 @@ impl Input {
326329
impl From<Input> for Module {
327330
/// Convert the `Input` builder struct into the finished `Module` struct.
328331
fn from(input: Input) -> Self {
329-
Module {
332+
let module = Module {
330333
mod_type: input.mod_type.clone(),
331334
title: input.title.clone(),
332335
id: input.id(),
333336
file_name: input.file_name(),
334337
include_statement: input.include_statement(),
335338
includes: input.includes.clone(),
336339
text: input.text(),
337-
}
340+
};
341+
342+
debug!("Generated module properties:");
343+
debug!("Type: {:?}", &module.mod_type);
344+
debug!("ID: {}", &module.id);
345+
debug!("File name: {}", &module.file_name);
346+
debug!("Include statement: {}", &module.include_statement);
347+
debug!("Included modules: {}", if let Some(includes) = &module.includes {includes.join(", ")} else {"none".to_string()} );
348+
349+
module
338350
}
339351
}
340352

src/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ 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());
17+
debug!("Writing file `{}`", &full_path.display());
1818

1919
// If the target file already exists, just print out an error
2020
if full_path.exists() {

0 commit comments

Comments
 (0)