[Logger, DatFile] Minor fixes to ordering and logging

This commit is contained in:
Matt Nadareski
2017-08-26 14:16:35 -07:00
parent 47f70838f1
commit 08a8ee67ad
2 changed files with 28 additions and 24 deletions

View File

@@ -498,14 +498,14 @@ namespace SabreTools.Library.Dats
dirNodump = 0;
}
Globals.Logger.Verbose("Beginning stat collection for '" + filename.Item1 + "'", false);
Globals.Logger.Verbose("Beginning stat collection for '{0}'", false, filename.Item1);
List<string> games = new List<string>();
DatFile datdata = new DatFile();
datdata.Parse(filename.Item1, 0, 0);
datdata.BucketBy(SortedBy.Game, false /* mergeroms */, norename: true);
// Output single DAT stats (if asked)
Globals.Logger.User("Adding stats for file '" + filename.Item1 + "'\n", false);
Globals.Logger.User("Adding stats for file '{0}'\n", false, filename.Item1);
if (single)
{
datdata.OutputStats(outputs, statDatFormat,

View File

@@ -239,17 +239,6 @@ namespace SabreTools.Library
return true;
}
/// <summary>
/// Write the given string as a verbose message to the log output
/// </summary>
/// <param name="output">String to be written log</param>
/// <param name="appendPrefix">True if the level and datetime should be prepended to each statement (default), false otherwise</param>
/// <returns>True if the output could be written, false otherwise</returns>s
public bool Verbose(string output, bool appendPrefix = true)
{
return Log(output, LogLevel.VERBOSE, appendPrefix);
}
/// <summary>
/// Write the given string as a verbose message to the log output
/// </summary>
@@ -262,14 +251,15 @@ namespace SabreTools.Library
}
/// <summary>
/// Write the given string as a user message to the log output
/// Write the given string as a verbose message to the log output
/// </summary>
/// <param name="output">String to be written log</param>
/// <param name="appendPrefix">True if the level and datetime should be prepended to each statement (default), false otherwise</param>
/// <param name="args">Optional arguments for string formatting</param>
/// <returns>True if the output could be written, false otherwise</returns>
public bool User(string output, bool appendPrefix = true)
public bool Verbose(string output, bool appendPrefix = true, params object[] args)
{
return Log(output, LogLevel.USER, appendPrefix);
return Log(output, LogLevel.VERBOSE, appendPrefix);
}
/// <summary>
@@ -284,15 +274,15 @@ namespace SabreTools.Library
}
/// <summary>
/// Write the given string as a warning to the log output
/// Write the given string as a user message to the log output
/// </summary>
/// <param name="output">String to be written log</param>
/// <param name="appendPrefix">True if the level and datetime should be prepended to each statement (default), false otherwise</param>
/// <param name="args">Optional arguments for string formatting</param>
/// <returns>True if the output could be written, false otherwise</returns>
public bool Warning(string output, bool appendPrefix = true)
public bool User(string output, bool appendPrefix = true, params object[] args)
{
_warnings = true;
return Log(output, LogLevel.WARNING, appendPrefix);
return Log(output, LogLevel.USER, appendPrefix);
}
/// <summary>
@@ -308,15 +298,16 @@ namespace SabreTools.Library
}
/// <summary>
/// Writes the given string as an error in the log
/// Write the given string as a warning to the log output
/// </summary>
/// <param name="output">String to be written log</param>
/// <param name="appendPrefix">True if the level and datetime should be prepended to each statement (default), false otherwise</param>
/// <param name="args">Optional arguments for string formatting</param>
/// <returns>True if the output could be written, false otherwise</returns>
public bool Error(string output, bool appendPrefix = true)
public bool Warning(string output, bool appendPrefix = true, params object[] args)
{
_errors = true;
return Log(output, LogLevel.ERROR, appendPrefix);
_warnings = true;
return Log(output, LogLevel.WARNING, appendPrefix);
}
/// <summary>
@@ -331,6 +322,19 @@ namespace SabreTools.Library
return Log(string.Format(output, args), LogLevel.ERROR, true);
}
/// <summary>
/// Writes the given string as an error in the log
/// </summary>
/// <param name="output">String to be written log</param>
/// <param name="appendPrefix">True if the level and datetime should be prepended to each statement (default), false otherwise</param>
/// <param name="args">Optional arguments for string formatting</param>
/// <returns>True if the output could be written, false otherwise</returns>
public bool Error(string output, bool appendPrefix = true, params object[] args)
{
_errors = true;
return Log(output, LogLevel.ERROR, appendPrefix);
}
/// <summary>
/// Clear lines beneath the given line in the console
/// </summary>