Instance logging with backing static class instead of Global

This commit is contained in:
Matt Nadareski
2020-10-07 15:42:30 -07:00
parent 348a2a2bcb
commit b7db9f7f14
69 changed files with 1034 additions and 834 deletions

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using SabreTools.Library.Data;
using SabreTools.Library.DatFiles;
using SabreTools.Library.DatItems;
using SabreTools.Library.IO;
@@ -120,16 +119,16 @@ namespace SabreTools.Library.FileTypes
catch (EndOfStreamException ex)
{
// Catch this but don't count it as an error because SharpCompress is unsafe
Globals.Logger.Verbose(ex);
logger.Verbose(ex);
}
catch (InvalidOperationException ex)
{
Globals.Logger.Warning(ex);
logger.Warning(ex);
encounteredErrors = true;
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
logger.Error(ex);
encounteredErrors = true;
}
@@ -244,7 +243,7 @@ namespace SabreTools.Library.FileTypes
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
logger.Error(ex);
ms = null;
realEntry = null;
}
@@ -291,7 +290,7 @@ namespace SabreTools.Library.FileTypes
// If we get a read error, log it and continue
if (zr != ZipReturn.ZipGood)
{
Globals.Logger.Warning($"An error occurred while reading archive {this.Filename}: Zip Error - {zr}");
logger.Warning($"An error occurred while reading archive {this.Filename}: Zip Error - {zr}");
zr = zf.ZipFileCloseReadStream();
continue;
}
@@ -323,7 +322,7 @@ namespace SabreTools.Library.FileTypes
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
logger.Error(ex);
return null;
}
@@ -376,7 +375,7 @@ namespace SabreTools.Library.FileTypes
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
logger.Error(ex);
}
return empties;
@@ -589,7 +588,7 @@ namespace SabreTools.Library.FileTypes
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
logger.Error(ex);
success = false;
}
finally
@@ -816,7 +815,7 @@ namespace SabreTools.Library.FileTypes
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
logger.Error(ex);
success = false;
}