[ALL] Massive code cleanup and reorganization

This commit is contained in:
Matt Nadareski
2016-10-24 12:58:57 -07:00
parent 88f11e5826
commit 9a3527921f
70 changed files with 11347 additions and 11220 deletions

View File

@@ -13,6 +13,17 @@ namespace SabreTools.Helper
/// </remarks>
public class Logger
{
/// <summary>
/// Severity of the logging statement
/// </summary>
private enum LogLevel
{
VERBOSE = 0,
USER,
WARNING,
ERROR,
}
// Private instance variables
private bool _tofile;
private bool _warnings;
@@ -24,6 +35,19 @@ namespace SabreTools.Helper
// Private required variables
private string _basepath = "logs" + Path.DirectorySeparatorChar;
/// <summary>
/// Initialize a console-only logger object
/// </summary>
public Logger()
{
_tofile = false;
_warnings = false;
_errors = false;
_filename = null;
Start();
}
/// <summary>
/// Initialize a Logger object with the given information
/// </summary>
@@ -33,6 +57,7 @@ namespace SabreTools.Helper
{
_tofile = tofile;
_warnings = false;
_errors = false;
_filename = Path.GetFileNameWithoutExtension(filename) + " (" + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ")" + Path.GetExtension(filename);
if (!Directory.Exists(_basepath))
@@ -77,17 +102,17 @@ namespace SabreTools.Helper
/// <returns>True if the logging was ended correctly, false otherwise</returns>
public bool Close(bool suppress = false)
{
if (_warnings)
{
Console.WriteLine("There were warnings in the last run! Check the log for more details");
}
if (_errors)
{
Console.WriteLine("There were errors in the last run! Check the log for more details");
}
if (!suppress)
{
if (_warnings)
{
Console.WriteLine("There were warnings in the last run! Check the log for more details");
}
if (_errors)
{
Console.WriteLine("There were errors in the last run! Check the log for more details");
}
TimeSpan span = DateTime.Now.Subtract(_start);
string total = span.ToString(@"hh\:mm\:ss\.fffff");
if (!_tofile)