mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user