Skip to content

Commit

Permalink
Apply proper formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteOtter committed Aug 14, 2024
1 parent 50b3f89 commit 6241069
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 53 deletions.
6 changes: 3 additions & 3 deletions isotoenv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
//! * `default-logging` - Provides you with a sensible logger configuration using the `env_logger` crate.
// Organize library structure
pub mod logging;
pub mod errors;
pub mod logging;

// Provide code on the root level of the library
#[cfg(feature = "default-logging")]
use crate::logging::init_default_logging;
#[cfg(feature = "default-logging")]
use crate::errors::util_errors::LoggingError;
#[cfg(feature = "default-logging")]
use crate::logging::init_default_logging;

#[cfg(feature = "default-logging")]
pub fn init_logging(level: Option<&str>) -> Result<(), LoggingError> {
Expand Down
30 changes: 15 additions & 15 deletions isotoenv/src/logging.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! This module provides a sensible default configuration of a logging system.
#[cfg(feature = "default-logging")]
use crate::errors::util_errors::LoggingError;
#[cfg(feature = "default-logging")]
use env_logger::Builder;
#[cfg(feature = "default-logging")]
use std::io::Write;
#[cfg(feature = "default-logging")]
use crate::errors::util_errors::LoggingError;

pub const LOG_TARGET: &str = "[isototest]";

Expand All @@ -22,18 +22,19 @@ pub(crate) fn init_default_logging(level: Option<&str>) -> Result<(), LoggingErr
Some("info") | None => {
log_builder(log::LevelFilter::Info);
Ok(())
},
}
Some("debug") => {
log_builder(log::LevelFilter::Debug);
Ok(())
},
}
Some("trace") => {
log_builder(log::LevelFilter::Trace);
Ok(())
},
Some(invalid) => {
Err(LoggingError::InvalidLogLevelError(format!("Invalid log level '{}'!", invalid)))
}
Some(invalid) => Err(LoggingError::InvalidLogLevelError(format!(
"Invalid log level '{}'!",
invalid
))),
}
}

Expand All @@ -43,14 +44,13 @@ fn log_builder(level: log::LevelFilter) {
.filter_level(level)
.format(|buf, record| {
writeln!(
buf,
"{} [{}] {}: {}",
buf.timestamp(),
record.level(),
record.target(),
record.args()
)
buf,
"{} [{}] {}: {}",
buf.timestamp(),
record.level(),
record.target(),
record.args()
)
})
.init();
}

6 changes: 3 additions & 3 deletions isotomachine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
//! * `default-logging` - Provides you with a sensible logger configuration using the `env_logger` crate.
// Organize library structure
pub mod logging;
pub mod errors;
pub mod logging;

// Provide code on the root level of the library
#[cfg(feature = "default-logging")]
use crate::logging::init_default_logging;
#[cfg(feature = "default-logging")]
use crate::errors::util_errors::LoggingError;
#[cfg(feature = "default-logging")]
use crate::logging::init_default_logging;

#[cfg(feature = "default-logging")]
pub fn init_logging(level: Option<&str>) -> Result<(), LoggingError> {
Expand Down
30 changes: 15 additions & 15 deletions isotomachine/src/logging.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! This module provides a sensible default configuration of a logging system.
#[cfg(feature = "default-logging")]
use crate::errors::util_errors::LoggingError;
#[cfg(feature = "default-logging")]
use env_logger::Builder;
#[cfg(feature = "default-logging")]
use std::io::Write;
#[cfg(feature = "default-logging")]
use crate::errors::util_errors::LoggingError;

pub const LOG_TARGET: &str = "[isototest]";

Expand All @@ -22,18 +22,19 @@ pub(crate) fn init_default_logging(level: Option<&str>) -> Result<(), LoggingErr
Some("info") | None => {
log_builder(log::LevelFilter::Info);
Ok(())
},
}
Some("debug") => {
log_builder(log::LevelFilter::Debug);
Ok(())
},
}
Some("trace") => {
log_builder(log::LevelFilter::Trace);
Ok(())
},
Some(invalid) => {
Err(LoggingError::InvalidLogLevelError(format!("Invalid log level '{}'!", invalid)))
}
Some(invalid) => Err(LoggingError::InvalidLogLevelError(format!(
"Invalid log level '{}'!",
invalid
))),
}
}

Expand All @@ -43,14 +44,13 @@ fn log_builder(level: log::LevelFilter) {
.filter_level(level)
.format(|buf, record| {
writeln!(
buf,
"{} [{}] {}: {}",
buf.timestamp(),
record.level(),
record.target(),
record.args()
)
buf,
"{} [{}] {}: {}",
buf.timestamp(),
record.level(),
record.target(),
record.args()
)
})
.init();
}

4 changes: 2 additions & 2 deletions isototest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ pub(crate) mod types;

// Provide code on the root level of the library
#[cfg(feature = "default-logging")]
use crate::logging::init_default_logging;
#[cfg(feature = "default-logging")]
use crate::errors::util_errors::LoggingError;
#[cfg(feature = "default-logging")]
use crate::logging::init_default_logging;

#[cfg(feature = "default-logging")]
pub fn init_logging(level: Option<&str>) -> Result<(), LoggingError> {
Expand Down
30 changes: 15 additions & 15 deletions isototest/src/logging.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! This module provides a sensible default configuration of a logging system.
#[cfg(feature = "default-logging")]
use crate::errors::util_errors::LoggingError;
#[cfg(feature = "default-logging")]
use env_logger::Builder;
#[cfg(feature = "default-logging")]
use std::io::Write;
#[cfg(feature = "default-logging")]
use crate::errors::util_errors::LoggingError;

pub const LOG_TARGET: &str = "[isototest]";

Expand All @@ -22,18 +22,19 @@ pub(crate) fn init_default_logging(level: Option<&str>) -> Result<(), LoggingErr
Some("info") | None => {
log_builder(log::LevelFilter::Info);
Ok(())
},
}
Some("debug") => {
log_builder(log::LevelFilter::Debug);
Ok(())
},
}
Some("trace") => {
log_builder(log::LevelFilter::Trace);
Ok(())
},
Some(invalid) => {
Err(LoggingError::InvalidLogLevelError(format!("Invalid log level '{}'!", invalid)))
}
Some(invalid) => Err(LoggingError::InvalidLogLevelError(format!(
"Invalid log level '{}'!",
invalid
))),
}
}

Expand All @@ -43,14 +44,13 @@ fn log_builder(level: log::LevelFilter) {
.filter_level(level)
.format(|buf, record| {
writeln!(
buf,
"{} [{}] {}: {}",
buf.timestamp(),
record.level(),
record.target(),
record.args()
)
buf,
"{} [{}] {}: {}",
buf.timestamp(),
record.level(),
record.target(),
record.args()
)
})
.init();
}

0 comments on commit 6241069

Please sign in to comment.