ConsoleLogRecordExporter modified to support Message and StateValues (#1871)
* ConsoleLogRecordExporter modified to support Message and StateValues * slighty better printing
This commit is contained in:
parent
21c440a284
commit
f2524286d1
|
|
@ -11,6 +11,7 @@ please check the latest changes
|
|||
|
||||
* Removed code that prints Baggage information
|
||||
([#1825](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1825))
|
||||
* LogRecordExporter exports Message and StateValues from LogRecord.
|
||||
|
||||
## 1.0.1
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,24 @@ namespace OpenTelemetry.Exporter
|
|||
this.WriteLine($"{"LogRecord.CategoryName:".PadRight(rightPaddingLength)}{logRecord.CategoryName}");
|
||||
this.WriteLine($"{"LogRecord.LogLevel:".PadRight(rightPaddingLength)}{logRecord.LogLevel}");
|
||||
this.WriteLine($"{"LogRecord.TraceFlags:".PadRight(rightPaddingLength)}{logRecord.TraceFlags}");
|
||||
this.WriteLine($"{"LogRecord.State:".PadRight(rightPaddingLength)}{logRecord.State}");
|
||||
if (logRecord.Message != null)
|
||||
{
|
||||
this.WriteLine($"{"LogRecord.Message:".PadRight(rightPaddingLength)}{logRecord.Message}");
|
||||
}
|
||||
|
||||
if (logRecord.State != null)
|
||||
{
|
||||
this.WriteLine($"{"LogRecord.State:".PadRight(rightPaddingLength)}{logRecord.State}");
|
||||
}
|
||||
else if (logRecord.StateValues != null)
|
||||
{
|
||||
this.WriteLine("LogRecord.StateValues (Key:Value):");
|
||||
for (int i = 0; i < logRecord.StateValues.Count; i++)
|
||||
{
|
||||
this.WriteLine($"{logRecord.StateValues[i].Key.PadRight(rightPaddingLength)}{logRecord.StateValues[i].Value}");
|
||||
}
|
||||
}
|
||||
|
||||
if (logRecord.Exception is { })
|
||||
{
|
||||
this.WriteLine($"{"LogRecord.Exception:".PadRight(rightPaddingLength)}{logRecord.Exception?.Message}");
|
||||
|
|
|
|||
Loading…
Reference in New Issue