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 { if present {
logs.filter(None, log::LogLevelFilter::Debug); logs.filter(None, log::LogLevelFilter::Debug);
} }
else {
logs.filter(None, log::LogLevelFilter::Off);
}
if let Err(e) = logs.init() { if let Err(e) = logs.init() {
writeln!(stderr(), "Failed to initialise logger: {}", e).unwrap(); writeln!(stderr(), "Failed to initialise logger: {}", e).unwrap();

View File

@ -214,9 +214,18 @@ impl<'a> Render<'a> {
if xattr::ENABLED { if xattr::ENABLED {
match file.path.attributes() { match file.path.attributes() {
Ok(xs) => xattrs.extend(xs), Ok(xs) => {
Err(e) => if self.opts.xattr { errors.push((e, None)) }, 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())); let table_row = table.as_ref().map(|t| t.row_for_file(&file, !xattrs.is_empty()));