diff --git a/DATabase/Helper/Logger.cs b/DATabase/Helper/Logger.cs
index dce576ad..adf6b196 100644
--- a/DATabase/Helper/Logger.cs
+++ b/DATabase/Helper/Logger.cs
@@ -13,6 +13,13 @@ namespace SabreTools.Helper
private string _filename;
private StreamWriter _log;
+ public enum LogLevel
+ {
+ VERBOSE = 0,
+ WARNING,
+ ERROR,
+ }
+
// Public wrappers
public bool ToFile
{
@@ -94,18 +101,19 @@ namespace SabreTools.Helper
/// Write the given string to the log output
///
/// String to be written log
+ /// Severity of the information being logged
/// True if the output could be written, false otherwise
- public bool Log(string output)
+ public bool Log(string output, LogLevel loglevel = LogLevel.VERBOSE)
{
// Everything writes to console
- Console.WriteLine(output);
+ Console.WriteLine(loglevel.ToString() + " " + output);
// If we're writing to file, use the existing stream
if (_tofile)
{
try
{
- _log.WriteLine(output);
+ _log.WriteLine(loglevel.ToString() + " " + output);
}
catch
{
@@ -117,6 +125,16 @@ namespace SabreTools.Helper
return true;
}
+ ///
+ /// Write the given string as a warning to the log output
+ ///
+ /// String to be written log
+ /// True if the output could be written, false otherwise
+ public bool Warning(string output)
+ {
+ return Log(output, LogLevel.WARNING);
+ }
+
///
/// Writes the given string as an error in the log
///
@@ -124,7 +142,7 @@ namespace SabreTools.Helper
/// True if the output could be written, false otherwise
public bool Error(string output)
{
- return Log("ERROR: " + output);
+ return Log(output, LogLevel.ERROR);
}
}
}