mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Instance logging with backing static class instead of Global
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
using SabreTools.Library.Data;
|
||||
using SabreTools.Library.DatItems;
|
||||
using SabreTools.Library.IO;
|
||||
using SabreTools.Library.Tools;
|
||||
@@ -80,7 +78,7 @@ namespace SabreTools.Library.DatFiles
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning(ex, $"Exception found while parsing '{filename}'");
|
||||
logger.Warning(ex, $"Exception found while parsing '{filename}'");
|
||||
if (throwOnError)
|
||||
{
|
||||
xtr.Dispose();
|
||||
@@ -529,13 +527,13 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
try
|
||||
{
|
||||
Globals.Logger.User($"Opening file for writing: {outfile}");
|
||||
logger.User($"Opening file for writing: {outfile}");
|
||||
FileStream fs = FileExtensions.TryCreate(outfile);
|
||||
|
||||
// If we get back null for some reason, just log and return
|
||||
if (fs == null)
|
||||
{
|
||||
Globals.Logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||
logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -591,13 +589,13 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write the file footer out
|
||||
WriteFooter(xtw);
|
||||
|
||||
Globals.Logger.Verbose("File written!" + Environment.NewLine);
|
||||
logger.Verbose("File written!" + Environment.NewLine);
|
||||
xtw.Dispose();
|
||||
fs.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex);
|
||||
logger.Error(ex);
|
||||
if (throwOnError) throw ex;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user