Logging overhaul!

This change brings about a few changes:
1) A new LogLevel called "User" that is used for non-verbose, non-error output
2) Only User and Error are output to console now, not all of them
3) All programs have log to file enabled by default and all flags for enabling logging have been removed
4) Some former Verbose statements have been converted over to User because of the shift in usage.
This commit is contained in:
Matt Nadareski
2016-05-10 15:41:33 -07:00
parent 37253b8c91
commit 1800ac6750
12 changed files with 80 additions and 85 deletions

View File

@@ -106,8 +106,11 @@ namespace SabreTools.Helper
/// <returns>True if the output could be written, false otherwise</returns>
public bool Log(string output, LogLevel loglevel = LogLevel.VERBOSE)
{
// Everything writes to console
Console.WriteLine(loglevel.ToString() + " " + output);
// USER and ERROR writes to console
if (loglevel == LogLevel.USER || loglevel == LogLevel.ERROR)
{
Console.WriteLine((loglevel == LogLevel.ERROR ? loglevel.ToString() + " " : "") + output);
}
// If we're writing to file, use the existing stream
if (_tofile)
@@ -127,6 +130,11 @@ namespace SabreTools.Helper
return true;
}
public bool User(string output)
{
return Log(output, LogLevel.USER);
}
/// <summary>
/// Write the given string as a warning to the log output
/// </summary>