private static void Message(LogMessageType type, string message) { LoadSettings(); if ((LoggingLevel & type) == 0) { return; } System.Diagnostics.Debug.WriteLine(string.Format("{0} {1}", type, message)); OnTraceMessage?.Invoke(type, message); if (!LoggingEnabled) { return; } string msg = FormatMessage(type, message); WriteMessageToLog(msg); }
private static void SetupAmqpLogging() { if (!settings.AmqpTraceEnabled) { Amqp.Trace.TraceLevel = 0; Amqp.Trace.TraceListener = null; return; } Amqp.TraceLevel level = 0; if ((settings.LoggingLevel & LogMessageType.Debug) != 0) { level |= (Amqp.TraceLevel.Frame | Amqp.TraceLevel.Verbose | Amqp.TraceLevel.Output); } if ((settings.LoggingLevel & LogMessageType.Warn) != 0) { level |= Amqp.TraceLevel.Warning; } if ((settings.LoggingLevel & LogMessageType.Error) != 0) { level |= Amqp.TraceLevel.Error; } if ((settings.LoggingLevel & LogMessageType.Info) != 0) { level |= Amqp.TraceLevel.Information; } Amqp.Trace.TraceLevel = level; if (level != 0) { Amqp.Trace.TraceListener = (l, f, a) => { string msg = string.Format(f, a); OnTraceMessage?.Invoke(LogMessageType.Debug, msg); System.Diagnostics.Debug.WriteLine(msg); WriteMessageToLog(msg); } } ; }