File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
OpenTelemetry.Exporter.Console
OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ public override ExportResult Export(in Batch<LogRecord> batch)
36
36
this . WriteLine ( $ "{ "LogRecord.TraceId:" . PadRight ( RightPaddingLength ) } { logRecord . TraceId } ") ;
37
37
this . WriteLine ( $ "{ "LogRecord.SpanId:" . PadRight ( RightPaddingLength ) } { logRecord . SpanId } ") ;
38
38
this . WriteLine ( $ "{ "LogRecord.Timestamp:" . PadRight ( RightPaddingLength ) } { logRecord . Timestamp : yyyy-MM-ddTHH:mm:ss.fffffffZ} ") ;
39
- this . WriteLine ( $ "{ "LogRecord.EventId:" . PadRight ( RightPaddingLength ) } { logRecord . EventId } ") ;
39
+ this . WriteLine ( $ "{ "LogRecord.EventId:" . PadRight ( RightPaddingLength ) } { logRecord . EventId . Id } ") ;
40
+ this . WriteLine ( $ "{ "LogRecord.EventName:" . PadRight ( RightPaddingLength ) } { logRecord . EventId . Name } ") ;
40
41
this . WriteLine ( $ "{ "LogRecord.CategoryName:" . PadRight ( RightPaddingLength ) } { logRecord . CategoryName } ") ;
41
42
this . WriteLine ( $ "{ "LogRecord.LogLevel:" . PadRight ( RightPaddingLength ) } { logRecord . LogLevel } ") ;
42
43
this . WriteLine ( $ "{ "LogRecord.TraceFlags:" . PadRight ( RightPaddingLength ) } { logRecord . TraceFlags } ") ;
Original file line number Diff line number Diff line change @@ -85,9 +85,10 @@ internal static OtlpLogs.LogRecord ToOtlpLog(this LogRecord logRecord)
85
85
}
86
86
}
87
87
88
- if ( logRecord . EventId != 0 )
88
+ if ( logRecord . EventId != default )
89
89
{
90
- otlpLogRecord . Attributes . AddStringAttribute ( nameof ( logRecord . EventId ) , logRecord . EventId . ToString ( ) ) ;
90
+ otlpLogRecord . Attributes . AddIntAttribute ( nameof ( logRecord . EventId . Id ) , logRecord . EventId . Id ) ;
91
+ otlpLogRecord . Attributes . AddStringAttribute ( nameof ( logRecord . EventId . Name ) , logRecord . EventId . Name ) ;
91
92
}
92
93
93
94
if ( logRecord . Exception != null )
@@ -124,5 +125,14 @@ private static void AddStringAttribute(this RepeatedField<OtlpCommon.KeyValue> r
124
125
Value = new OtlpCommon . AnyValue { StringValue = value } ,
125
126
} ) ;
126
127
}
128
+
129
+ private static void AddIntAttribute ( this RepeatedField < OtlpCommon . KeyValue > repeatedField , string key , int value )
130
+ {
131
+ repeatedField . Add ( new OtlpCommon . KeyValue
132
+ {
133
+ Key = key ,
134
+ Value = new OtlpCommon . AnyValue { IntValue = value } ,
135
+ } ) ;
136
+ }
127
137
}
128
138
}
You can’t perform that action at this time.
0 commit comments