From a4ddc014ee3bd2c2f32c30faf32f4be92f210704 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 20 Sep 2025 16:00:03 -0400 Subject: [PATCH] Better debug logging --- BinaryObjectScanner/Scanner.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/BinaryObjectScanner/Scanner.cs b/BinaryObjectScanner/Scanner.cs index cf85a09c..24b44cd8 100644 --- a/BinaryObjectScanner/Scanner.cs +++ b/BinaryObjectScanner/Scanner.cs @@ -287,15 +287,17 @@ namespace BinaryObjectScanner } catch (Exception ex) { - if (_includeDebug) Console.WriteLine(ex); - + if (_includeDebug) Console.Error.WriteLine(ex); return []; } // Get the file type either from magic number or extension WrapperType fileType = WrapperFactory.GetFileType(magic, extension); if (fileType == WrapperType.UNKNOWN) + { + if (_includeDebug) Console.WriteLine($"{fileName} not a scannable file type, skipping..."); return []; + } // Get the wrapper, if possible var wrapper = WrapperFactory.CreateWrapper(fileType, stream); @@ -338,7 +340,7 @@ namespace BinaryObjectScanner } catch (Exception ex) { - if (_includeDebug) Console.WriteLine(ex); + if (_includeDebug) Console.Error.WriteLine(ex); } // Prepare the returned protections @@ -349,7 +351,7 @@ namespace BinaryObjectScanner } catch (Exception ex) { - if (_includeDebug) Console.WriteLine(ex); + if (_includeDebug) Console.Error.WriteLine(ex); } }