using System; namespace MQTTnet.Core.Diagnostics { public static class MqttTrace { public static event EventHandler TraceMessagePublished; public static void Verbose(string source, string message) { Publish(source, MqttTraceLevel.Verbose, null, message); } public static void Information(string source, string message) { Publish(source, MqttTraceLevel.Information, null, message); } public static void Warning(string source, string message) { Publish(source, MqttTraceLevel.Warning, null, message); } public static void Warning(string source, Exception exception, string message) { Publish(source, MqttTraceLevel.Warning, exception, message); } public static void Error(string source, string message) { Publish(source, MqttTraceLevel.Error, null, message); } public static void Error(string source, Exception exception, string message) { Publish(source, MqttTraceLevel.Error, exception, message); } private static void Publish(string source, MqttTraceLevel traceLevel, Exception exception, string message) { TraceMessagePublished?.Invoke(null, new MqttTraceMessagePublishedEventArgs(Environment.CurrentManagedThreadId, source, traceLevel, message, exception)); } } }