-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add status logging to functions * Add default logger configuration behind an optional feature
- Loading branch information
ByteOtter
committed
Aug 6, 2024
1 parent
6e7e6cc
commit f371f47
Showing
6 changed files
with
89 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//! This module provides a sensible default configuration of a logging system. | ||
#[cfg(feature = "default-logging")] | ||
use env_logger::Builder; | ||
#[cfg(feature = "default-logging")] | ||
use std::io::Write; | ||
|
||
pub const LOG_TARGET: &str = "[isototest]"; | ||
|
||
#[cfg(feature = "default-logging")] | ||
/// Initialize default logging configuration. | ||
pub fn initialize_default_logging() { | ||
Builder::new() | ||
.filter_level(log::LevelFilter::Info) | ||
.format(|bug, record| { | ||
writeln!( | ||
buf, | ||
"{} [{}] {}: {}", | ||
buf.timestamp, | ||
record.level(), | ||
record.target(), | ||
record.args() | ||
) | ||
}) | ||
.init(); | ||
} |