Explorar o código

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.
Benjamin Sago %!s(int64=8) %!d(string=hai) anos
pai
achega
a5e177afe5
Modificáronse 2 ficheiros con 15 adicións e 3 borrados
  1. 3 0
      src/bin/main.rs
  2. 12 3
      src/output/details.rs

+ 3 - 0
src/bin/main.rs

@@ -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();

+ 12 - 3
src/output/details.rs

@@ -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),
-                            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()));
                     let table_row = table.as_ref().map(|t| t.row_for_file(&file, !xattrs.is_empty()));