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