mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Be more explcit about signatures in Logging
This commit is contained in:
@@ -15,32 +15,50 @@ namespace SabreTools.Logging
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// LogLevel for the event
|
/// LogLevel for the event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LogLevel LogLevel { get; set; } = LogLevel.VERBOSE;
|
public readonly LogLevel LogLevel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Log statement to be printed
|
/// Log statement to be printed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Statement { get; set; } = null;
|
public readonly string? Statement = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Exception to be passed along to the event handler
|
/// Exception to be passed along to the event handler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Exception? Exception { get; set; } = null;
|
public readonly Exception? Exception = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total count for progress log events
|
/// Total count for progress log events
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long? TotalCount { get; set; } = null;
|
public readonly long? TotalCount = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current count for progress log events
|
/// Current count for progress log events
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long? CurrentCount { get; set; } = null;
|
public readonly long? CurrentCount = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Statement constructor
|
||||||
|
/// </summary>
|
||||||
|
public LogEventArgs(LogLevel logLevel, string statement)
|
||||||
|
{
|
||||||
|
LogLevel = logLevel;
|
||||||
|
Statement = statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Statement constructor
|
||||||
|
/// </summary>
|
||||||
|
public LogEventArgs(LogLevel logLevel, Exception exception)
|
||||||
|
{
|
||||||
|
LogLevel = logLevel;
|
||||||
|
Exception = exception;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Statement and exception constructor
|
/// Statement and exception constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LogEventArgs(LogLevel logLevel = LogLevel.VERBOSE, string? statement = null, Exception? exception = null)
|
public LogEventArgs(LogLevel logLevel, string statement, Exception exception)
|
||||||
{
|
{
|
||||||
LogLevel = logLevel;
|
LogLevel = logLevel;
|
||||||
Statement = statement;
|
Statement = statement;
|
||||||
@@ -50,7 +68,7 @@ namespace SabreTools.Logging
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Progress constructor
|
/// Progress constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LogEventArgs(long total, long current, LogLevel logLevel = LogLevel.VERBOSE, string? statement = null)
|
public LogEventArgs(long total, long current, LogLevel logLevel, string? statement = null)
|
||||||
{
|
{
|
||||||
LogLevel = logLevel;
|
LogLevel = logLevel;
|
||||||
Statement = statement;
|
Statement = statement;
|
||||||
|
|||||||
@@ -23,16 +23,7 @@ namespace SabreTools.Logging
|
|||||||
|
|
||||||
#region Log Event Triggers
|
#region Log Event Triggers
|
||||||
|
|
||||||
/// <summary>
|
#region Verbose
|
||||||
/// Write the given exception as a verbose message to the log output
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ex">Exception to be written log</param>
|
|
||||||
/// <param name="output">String to be written log</param>
|
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
|
||||||
public void Verbose(Exception ex, string? output = null)
|
|
||||||
{
|
|
||||||
LoggerImpl.Verbose(_instance, ex, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given string as a verbose message to the log output
|
/// Write the given string as a verbose message to the log output
|
||||||
@@ -40,9 +31,24 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
public void Verbose(string output)
|
public void Verbose(string output)
|
||||||
{
|
=> LoggerImpl.Verbose(_instance, output);
|
||||||
LoggerImpl.Verbose(_instance, output);
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Write the given exception as a verbose message to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public void Verbose(Exception ex)
|
||||||
|
=> LoggerImpl.Verbose(_instance, ex);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write the given exception and string as a verbose message to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <param name="output">String to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public void Verbose(Exception ex, string output)
|
||||||
|
=> LoggerImpl.Verbose(_instance, ex, output);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given verbose progress message to the log output
|
/// Write the given verbose progress message to the log output
|
||||||
@@ -51,20 +57,11 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="current">Current count for progres</param>
|
/// <param name="current">Current count for progres</param>
|
||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
public void Verbose(long total, long current, string? output = null)
|
public void Verbose(long total, long current, string? output = null)
|
||||||
{
|
=> LoggerImpl.Verbose(_instance, total, current, output);
|
||||||
LoggerImpl.Verbose(_instance, total, current, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Write the given exception as a user message to the log output
|
|
||||||
/// </summary>
|
#region User
|
||||||
/// <param name="ex">Exception to be written log</param>
|
|
||||||
/// <param name="output">String to be written log</param>
|
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
|
||||||
public void User(Exception ex, string? output = null)
|
|
||||||
{
|
|
||||||
LoggerImpl.User(_instance, ex, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given string as a user message to the log output
|
/// Write the given string as a user message to the log output
|
||||||
@@ -72,9 +69,24 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
public void User(string output)
|
public void User(string output)
|
||||||
{
|
=> LoggerImpl.User(_instance, output);
|
||||||
LoggerImpl.User(_instance, output);
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Write the given exception as a user message to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public void User(Exception ex)
|
||||||
|
=> LoggerImpl.User(_instance, ex);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write the given exception and string as a user message to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <param name="output">String to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public void User(Exception ex, string output)
|
||||||
|
=> LoggerImpl.User(_instance, ex, output);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given user progress message to the log output
|
/// Write the given user progress message to the log output
|
||||||
@@ -83,20 +95,11 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="current">Current count for progres</param>
|
/// <param name="current">Current count for progres</param>
|
||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
public void User(long total, long current, string? output = null)
|
public void User(long total, long current, string? output = null)
|
||||||
{
|
=> LoggerImpl.User(_instance, total, current, output);
|
||||||
LoggerImpl.User(_instance, total, current, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Write the given exception as a warning to the log output
|
|
||||||
/// </summary>
|
#region Warning
|
||||||
/// <param name="ex">Exception to be written log</param>
|
|
||||||
/// <param name="output">String to be written log</param>
|
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
|
||||||
public void Warning(Exception ex, string? output = null)
|
|
||||||
{
|
|
||||||
LoggerImpl.Warning(_instance, ex, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given string as a warning to the log output
|
/// Write the given string as a warning to the log output
|
||||||
@@ -104,9 +107,24 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
public void Warning(string output)
|
public void Warning(string output)
|
||||||
{
|
=> LoggerImpl.Warning(_instance, output);
|
||||||
LoggerImpl.Warning(_instance, output);
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Write the given exception as a warning to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public void Warning(Exception ex)
|
||||||
|
=> LoggerImpl.Warning(_instance, ex);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write the given exception and string 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>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public void Warning(Exception ex, string output)
|
||||||
|
=> LoggerImpl.Warning(_instance, ex, output);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given warning progress message to the log output
|
/// Write the given warning progress message to the log output
|
||||||
@@ -115,20 +133,11 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="current">Current count for progres</param>
|
/// <param name="current">Current count for progres</param>
|
||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
public void Warning(long total, long current, string? output = null)
|
public void Warning(long total, long current, string? output = null)
|
||||||
{
|
=> LoggerImpl.Warning(_instance, total, current, output);
|
||||||
LoggerImpl.Warning(_instance, total, current, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Writes the given exception as an error in the log
|
|
||||||
/// </summary>
|
#region Error
|
||||||
/// <param name="ex">Exception to be written log</param>
|
|
||||||
/// <param name="output">String to be written log</param>
|
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
|
||||||
public void Error(Exception ex, string? output = null)
|
|
||||||
{
|
|
||||||
LoggerImpl.Error(_instance, ex, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the given string as an error in the log
|
/// Writes the given string as an error in the log
|
||||||
@@ -136,9 +145,24 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
public void Error(string output)
|
public void Error(string output)
|
||||||
{
|
=> LoggerImpl.Error(_instance, output);
|
||||||
LoggerImpl.Error(_instance, output);
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Writes the given exception as an error in the log
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public void Error(Exception ex)
|
||||||
|
=> LoggerImpl.Error(_instance, ex);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the given exception and string 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>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public void Error(Exception ex, string output)
|
||||||
|
=> LoggerImpl.Error(_instance, ex, output);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given error progress message to the log output
|
/// Write the given error progress message to the log output
|
||||||
@@ -147,9 +171,9 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="current">Current count for progres</param>
|
/// <param name="current">Current count for progres</param>
|
||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
public void Error(long total, long current, string? output = null)
|
public void Error(long total, long current, string? output = null)
|
||||||
{
|
=> LoggerImpl.Error(_instance, total, current, output);
|
||||||
LoggerImpl.Error(_instance, total, current, output);
|
|
||||||
}
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,17 +285,7 @@ namespace SabreTools.Logging
|
|||||||
|
|
||||||
#region Log Event Triggers
|
#region Log Event Triggers
|
||||||
|
|
||||||
/// <summary>
|
#region Verbose
|
||||||
/// Write the given exception as a verbose message to the log output
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="instance">Instance object that's the source of logging</param>
|
|
||||||
/// <param name="ex">Exception to be written log</param>
|
|
||||||
/// <param name="output">String to be written log</param>
|
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
|
||||||
public static void Verbose(object? instance, Exception ex, string? output = null)
|
|
||||||
{
|
|
||||||
LogEventHandler(instance, new LogEventArgs(LogLevel.VERBOSE, output, ex));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given string as a verbose message to the log output
|
/// Write the given string as a verbose message to the log output
|
||||||
@@ -304,9 +294,26 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
public static void Verbose(object? instance, string output)
|
public static void Verbose(object? instance, string output)
|
||||||
{
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.VERBOSE, output));
|
||||||
LogEventHandler(instance, new LogEventArgs(LogLevel.VERBOSE, output, null));
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Write the given exception as a verbose message to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance">Instance object that's the source of logging</param>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public static void Verbose(object? instance, Exception ex)
|
||||||
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.VERBOSE, ex));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write the given exception and string as a verbose message to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance">Instance object that's the source of logging</param>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <param name="output">String to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public static void Verbose(object? instance, Exception ex, string output)
|
||||||
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.VERBOSE, output, ex));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given verbose progress message to the log output
|
/// Write the given verbose progress message to the log output
|
||||||
@@ -316,21 +323,11 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="current">Current count for progres</param>
|
/// <param name="current">Current count for progres</param>
|
||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
public static void Verbose(object? instance, long total, long current, string? output = null)
|
public static void Verbose(object? instance, long total, long current, string? output = null)
|
||||||
{
|
=> LogEventHandler(instance, new LogEventArgs(total, current, LogLevel.VERBOSE, output));
|
||||||
LogEventHandler(instance, new LogEventArgs(total, current, LogLevel.VERBOSE, output));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Write the given exception as a user message to the log output
|
|
||||||
/// </summary>
|
#region User
|
||||||
/// <param name="instance">Instance object that's the source of logging</param>
|
|
||||||
/// <param name="ex">Exception to be written log</param>
|
|
||||||
/// <param name="output">String to be written log</param>
|
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
|
||||||
public static void User(object? instance, Exception ex, string? output = null)
|
|
||||||
{
|
|
||||||
LogEventHandler(instance, new LogEventArgs(LogLevel.USER, output, ex));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given string as a user message to the log output
|
/// Write the given string as a user message to the log output
|
||||||
@@ -339,9 +336,26 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
public static void User(object? instance, string output)
|
public static void User(object? instance, string output)
|
||||||
{
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.USER, output));
|
||||||
LogEventHandler(instance, new LogEventArgs(LogLevel.USER, output, null));
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Write the given exception as a user message to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance">Instance object that's the source of logging</param>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public static void User(object? instance, Exception ex)
|
||||||
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.USER, ex));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write the given exception and string as a user message to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance">Instance object that's the source of logging</param>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <param name="output">String to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public static void User(object? instance, Exception ex, string output)
|
||||||
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.USER, output, ex));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given user progress message to the log output
|
/// Write the given user progress message to the log output
|
||||||
@@ -351,21 +365,11 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="current">Current count for progres</param>
|
/// <param name="current">Current count for progres</param>
|
||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
public static void User(object? instance, long total, long current, string? output = null)
|
public static void User(object? instance, long total, long current, string? output = null)
|
||||||
{
|
=> LogEventHandler(instance, new LogEventArgs(total, current, LogLevel.USER, output));
|
||||||
LogEventHandler(instance, new LogEventArgs(total, current, LogLevel.USER, output));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Write the given exception as a warning to the log output
|
|
||||||
/// </summary>
|
#region Warning
|
||||||
/// <param name="instance">Instance object that's the source of logging</param>
|
|
||||||
/// <param name="ex">Exception to be written log</param>
|
|
||||||
/// <param name="output">String to be written log</param>
|
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
|
||||||
public static void Warning(object? instance, Exception ex, string? output = null)
|
|
||||||
{
|
|
||||||
LogEventHandler(instance, new LogEventArgs(LogLevel.WARNING, output, ex));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given string as a warning to the log output
|
/// Write the given string as a warning to the log output
|
||||||
@@ -374,9 +378,26 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
public static void Warning(object? instance, string output)
|
public static void Warning(object? instance, string output)
|
||||||
{
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.WARNING, output));
|
||||||
LogEventHandler(instance, new LogEventArgs(LogLevel.WARNING, output, null));
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Write the given exception as a warning to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance">Instance object that's the source of logging</param>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public static void Warning(object? instance, Exception ex)
|
||||||
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.WARNING, ex));
|
||||||
|
|
||||||
|
//// <summary>
|
||||||
|
/// Write the given exception and string as a warning to the log output
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance">Instance object that's the source of logging</param>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <param name="output">String to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public static void Warning(object? instance, Exception ex, string output)
|
||||||
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.WARNING, output, ex));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given warning progress message to the log output
|
/// Write the given warning progress message to the log output
|
||||||
@@ -386,21 +407,11 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="current">Current count for progres</param>
|
/// <param name="current">Current count for progres</param>
|
||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
public static void Warning(object? instance, long total, long current, string? output = null)
|
public static void Warning(object? instance, long total, long current, string? output = null)
|
||||||
{
|
=> LogEventHandler(instance, new LogEventArgs(total, current, LogLevel.WARNING, output));
|
||||||
LogEventHandler(instance, new LogEventArgs(total, current, LogLevel.WARNING, output));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Writes the given exception as an error in the log
|
|
||||||
/// </summary>
|
#region Error
|
||||||
/// <param name="instance">Instance object that's the source of logging</param>
|
|
||||||
/// <param name="ex">Exception to be written log</param>
|
|
||||||
/// <param name="output">String to be written log</param>
|
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
|
||||||
public static void Error(object? instance, Exception ex, string? output = null)
|
|
||||||
{
|
|
||||||
LogEventHandler(instance, new LogEventArgs(LogLevel.ERROR, output, ex));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the given string as an error in the log
|
/// Writes the given string as an error in the log
|
||||||
@@ -409,9 +420,26 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
/// <returns>True if the output could be written, false otherwise</returns>
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
public static void Error(object? instance, string output)
|
public static void Error(object? instance, string output)
|
||||||
{
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.ERROR, output));
|
||||||
LogEventHandler(instance, new LogEventArgs(LogLevel.ERROR, output, null));
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Writes the given exception as an error in the log
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance">Instance object that's the source of logging</param>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public static void Error(object? instance, Exception ex)
|
||||||
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.ERROR, ex));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the given exception and string as an error in the log
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance">Instance object that's the source of logging</param>
|
||||||
|
/// <param name="ex">Exception to be written log</param>
|
||||||
|
/// <param name="output">String to be written log</param>
|
||||||
|
/// <returns>True if the output could be written, false otherwise</returns>
|
||||||
|
public static void Error(object? instance, Exception ex, string output)
|
||||||
|
=> LogEventHandler(instance, new LogEventArgs(LogLevel.ERROR, output, ex));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the given error progress message to the log output
|
/// Write the given error progress message to the log output
|
||||||
@@ -421,9 +449,9 @@ namespace SabreTools.Logging
|
|||||||
/// <param name="current">Current count for progres</param>
|
/// <param name="current">Current count for progres</param>
|
||||||
/// <param name="output">String to be written log</param>
|
/// <param name="output">String to be written log</param>
|
||||||
public static void Error(object? instance, long total, long current, string? output = null)
|
public static void Error(object? instance, long total, long current, string? output = null)
|
||||||
{
|
=> LogEventHandler(instance, new LogEventArgs(total, current, LogLevel.ERROR, output));
|
||||||
LogEventHandler(instance, new LogEventArgs(total, current, LogLevel.ERROR, output));
|
|
||||||
}
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user