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

@@ -81,16 +81,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;
}
@@ -175,7 +175,7 @@ namespace SabreTools.Library.FileTypes
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
logger.Error(ex);
ms = null;
realEntry = null;
}
@@ -239,7 +239,7 @@ namespace SabreTools.Library.FileTypes
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
logger.Error(ex);
return null;
}
}
@@ -273,7 +273,7 @@ namespace SabreTools.Library.FileTypes
// Check if the name is the right length
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.xz"))
{
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
return false;
}
@@ -295,7 +295,7 @@ namespace SabreTools.Library.FileTypes
// Check if the name is the right length
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.xz"))
{
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
return null;
}
@@ -327,7 +327,7 @@ namespace SabreTools.Library.FileTypes
// Check that the input file exists
if (!File.Exists(inputFile))
{
Globals.Logger.Warning($"File '{inputFile}' does not exist!");
logger.Warning($"File '{inputFile}' does not exist!");
return false;
}