Now we can log OS error 95

The error in #178 was being hidden from output most of the time, and because exa isn’t a GUI program, there’s nowhere it can really dump log output like this. Now that users can opt in with the EXA_DEBUG variable, there is a place it can go.

Also stop the ERROR log level being printed by default.
This commit is contained in:
Benjamin Sago 2017-08-19 11:03:53 +01:00
parent 377260d88c
commit a5e177afe5
2 changed files with 15 additions and 3 deletions

View File

@ -56,6 +56,9 @@ pub fn configure_logger() {
if present {
logs.filter(None, log::LogLevelFilter::Debug);
}
else {
logs.filter(None, log::LogLevelFilter::Off);
}
if let Err(e) = logs.init() {
writeln!(stderr(), "Failed to initialise logger: {}", e).unwrap();

View File

@ -214,9 +214,18 @@ impl<'a> Render<'a> {
if xattr::ENABLED {
match file.path.attributes() {
Ok(xs) => xattrs.extend(xs),
Err(e) => if self.opts.xattr { errors.push((e, None)) },
};
Ok(xs) => {
xattrs.extend(xs);
}
Err(e) => {
if self.opts.xattr {
errors.push((e, None));
}
else {
error!("Error looking up xattr for {:?}: {:#?}", file.path, e);
}
}
}
}
let table_row = table.as_ref().map(|t| t.row_for_file(&file, !xattrs.is_empty()));