浏览代码

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

正在加载...
取消
保存