#[miri_run]
fn init_logger() {
+ const NSPACES: usize = 40;
let format = |record: &log::LogRecord| {
// prepend spaces to indent the final string
let indentation = log_settings::settings().indentation;
- let spaces = " ";
- let depth = indentation / spaces.len();
- let indentation = indentation % spaces.len();
- let indentation = &spaces[..indentation];
- format!("{}:{}{:2}{} {}", record.level(), record.location().module_path(), depth, indentation, record.args())
+ let depth = indentation / NSPACES;
+ let indentation = indentation % NSPACES;
+ format!("{lvl}:{module}{depth:2}{indent:<indentation$}{text}",
+ lvl = record.level(),
+ module = record.location().module_path(),
+ depth = depth,
+ indentation = indentation,
+ indent = "",
+ text = record.args())
};
let mut builder = env_logger::LogBuilder::new();