Skip to content

Commit 4417c65

Browse files
authored
display formatter implementation (Cuprate#457)
* display formatter implementation * show file system configuration * updating display format to have pretty debug
1 parent 2acced6 commit 4417c65

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

binaries/cuprated/src/config.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! cuprated config
22
use std::{
3+
fmt,
34
fs::{read_to_string, File},
45
io,
56
path::Path,
@@ -262,6 +263,15 @@ impl Config {
262263
}
263264
}
264265

266+
impl fmt::Display for Config {
267+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
268+
writeln!(
269+
f,
270+
"========== CONFIGURATION ==========\n{self:#?}\n==================================="
271+
)
272+
}
273+
}
274+
265275
#[cfg(test)]
266276
mod test {
267277
use toml::from_str;

binaries/cuprated/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ fn main() {
6161
// Initialize logging.
6262
logging::init_logging(&config);
6363

64+
//Printing configuration
65+
info!("{config}");
66+
6467
// Initialize the thread-pools
6568

6669
init_global_rayon_pool(&config);

0 commit comments

Comments
 (0)