Skip to content

Commit a4ddc01

Browse files
committed
Better debug logging
1 parent 61d186c commit a4ddc01

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

BinaryObjectScanner/Scanner.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,17 @@ private ProtectionDictionary GetInternalProtections(string fileName, Stream stre
287287
}
288288
catch (Exception ex)
289289
{
290-
if (_includeDebug) Console.WriteLine(ex);
291-
290+
if (_includeDebug) Console.Error.WriteLine(ex);
292291
return [];
293292
}
294293

295294
// Get the file type either from magic number or extension
296295
WrapperType fileType = WrapperFactory.GetFileType(magic, extension);
297296
if (fileType == WrapperType.UNKNOWN)
297+
{
298+
if (_includeDebug) Console.WriteLine($"{fileName} not a scannable file type, skipping...");
298299
return [];
300+
}
299301

300302
// Get the wrapper, if possible
301303
var wrapper = WrapperFactory.CreateWrapper(fileType, stream);
@@ -338,7 +340,7 @@ private ProtectionDictionary GetInternalProtections(string fileName, Stream stre
338340
}
339341
catch (Exception ex)
340342
{
341-
if (_includeDebug) Console.WriteLine(ex);
343+
if (_includeDebug) Console.Error.WriteLine(ex);
342344
}
343345

344346
// Prepare the returned protections
@@ -349,7 +351,7 @@ private ProtectionDictionary GetInternalProtections(string fileName, Stream stre
349351
}
350352
catch (Exception ex)
351353
{
352-
if (_includeDebug) Console.WriteLine(ex);
354+
if (_includeDebug) Console.Error.WriteLine(ex);
353355
}
354356
}
355357

0 commit comments

Comments
 (0)