Make logging more intuitive

This commit is contained in:
Matt Nadareski
2020-09-15 14:38:37 -07:00
parent f506915a04
commit fc580c7d35
29 changed files with 88 additions and 64 deletions

View File

@@ -247,6 +247,18 @@ namespace SabreTools.Library.Logging
return Log(output, LogLevel.USER, appendPrefix);
}
/// <summary>
/// Write the given exception as a warning to the log output
/// </summary>
/// <param name="ex">Exception to be written log</param>
/// <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>
public bool Warning(Exception ex, string output = null, bool appendPrefix = true)
{
return Warning($"{(output != null ? output + ": " : string.Empty)}{ex}", appendPrefix);
}
/// <summary>
/// Write the given string as a warning to the log output
/// </summary>
@@ -259,6 +271,18 @@ namespace SabreTools.Library.Logging
return Log(output, LogLevel.WARNING, appendPrefix);
}
/// <summary>
/// Writes the given exception as an error in the log
/// </summary>
/// <param name="ex">Exception to be written log</param>
/// <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>
public bool Error(Exception ex, string output = null, bool appendPrefix = true)
{
return Error($"{(output != null ? output + ": " : string.Empty)}{ex}", appendPrefix);
}
/// <summary>
/// Writes the given string as an error in the log
/// </summary>