mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-27 08:42:37 +08:00
Override ToString() for LogMessage
This commit is contained in:
@@ -28,5 +28,16 @@ namespace MQTTnet.Diagnostics
|
|||||||
public string Message { get; }
|
public string Message { get; }
|
||||||
|
|
||||||
public Exception Exception { 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user