use a number for the maximum indentation instead of relying on str::len()

This commit is contained in:
Oliver Schneider 2016-06-01 17:58:50 +02:00
parent f9a5416135
commit b7df4fdc75
No known key found for this signature in database
GPG key ID: 56D6EEA0FC67AC46

View file

@ -44,8 +44,8 @@ fn init_logger() {
let format = |record: &log::LogRecord| {
// prepend spaces to indent the final string
let indentation = log_settings::settings().indentation;
let spaces = " | | | | | | | | ";
let indentation = &spaces[..std::cmp::min(indentation, spaces.len())];
let spaces = " | | | | | | | | |";
let indentation = &spaces[..std::cmp::min(indentation, 44)];
format!("{}:{}|{} {}", record.level(), record.location().module_path(), indentation, record.args())
};