Sfoglia il codice sorgente

Make string format optional if no trace listener is attached

release/3.x.x
Christian Kratky 7 anni fa
parent
commit
0907eadb55
1 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  1. +8
    -1
      MQTTnet.Core/Diagnostics/MqttTrace.cs

+ 8
- 1
MQTTnet.Core/Diagnostics/MqttTrace.cs Vedi File

@@ -38,7 +38,14 @@ namespace MQTTnet.Core.Diagnostics

private static void Publish(string source, MqttTraceLevel traceLevel, Exception exception, string message)
{
TraceMessagePublished?.Invoke(null, new MqttTraceMessagePublishedEventArgs(Environment.CurrentManagedThreadId, source, traceLevel, message, exception));
var handler = TraceMessagePublished;
if (handler == null)
{
return;
}

message = string.Format(message, 1);
handler.Invoke(null, new MqttTraceMessagePublishedEventArgs(Environment.CurrentManagedThreadId, source, traceLevel, message, exception));
}
}
}

Caricamento…
Annulla
Salva