Sfoglia il codice sorgente

Override ToString() for LogMessage

release/3.x.x
Christian 6 anni fa
parent
commit
6e828d091f
1 ha cambiato i file con 11 aggiunte e 0 eliminazioni
  1. +11
    -0
      Frameworks/MQTTnet.NetStandard/Diagnostics/MqttNetLogMessage.cs

+ 11
- 0
Frameworks/MQTTnet.NetStandard/Diagnostics/MqttNetLogMessage.cs Vedi File

@@ -28,5 +28,16 @@ namespace MQTTnet.Diagnostics
public string Message { get; }

public Exception Exception { get; }

public override string ToString()
{
var result = $"[{Timestamp:O}] [{LogId}] [{ThreadId}] [{Source}] [{Level}]: {Message}";
if (Exception != null)
{
result += Environment.NewLine + Exception;
}

return result;
}
}
}

Caricamento…
Annulla
Salva