using System; using SabreTools.Core; namespace SabreTools.Logging { /// /// Generic delegate type for log events /// public delegate void LogEventHandler(object? sender, LogEventArgs args); /// /// Logging specific event arguments /// public class LogEventArgs : EventArgs { /// /// LogLevel for the event /// public LogLevel LogLevel { get; set; } = LogLevel.VERBOSE; /// /// Log statement to be printed /// public string? Statement { get; set; } = null; /// /// Exception to be passed along to the event handler /// public Exception? Exception { get; set; } = null; /// /// Total count for progress log events /// public long? TotalCount { get; set; } = null; /// /// Current count for progress log events /// public long? CurrentCount { get; set; } = null; /// /// Statement and exception constructor /// public LogEventArgs(LogLevel logLevel = LogLevel.VERBOSE, string? statement = null, Exception? exception = null) { this.LogLevel = logLevel; this.Statement = statement; this.Exception = exception; } /// /// Progress constructor /// public LogEventArgs(long total, long current, LogLevel logLevel = LogLevel.VERBOSE, string? statement = null) { this.LogLevel = logLevel; this.Statement = statement; this.TotalCount = total; this.CurrentCount = current; } } }