瀏覽代碼

Override ToString() for LogMessage

release/3.x.x
Christian 6 年之前
父節點
當前提交
6e828d091f
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. +11
    -0
      Frameworks/MQTTnet.NetStandard/Diagnostics/MqttNetLogMessage.cs

+ 11
- 0
Frameworks/MQTTnet.NetStandard/Diagnostics/MqttNetLogMessage.cs 查看文件

@@ -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;
}
}
}

Loading…
取消
儲存