File tree 1 file changed +12
-5
lines changed
src/Serilog.Sinks.Aliyun/Serilog/Sinks/Aliyun/Batched
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -52,18 +52,25 @@ public async Task EmitBatchAsync(IEnumerable<LogEvent> events)
52
52
Time = logEvent . Timestamp
53
53
} ;
54
54
55
- log . Contents . Add ( "Level" , logEvent . Level . ToString ( ) ) ;
56
- log . Contents . Add ( "Message" , logEvent . RenderMessage ( ) ) ;
57
-
55
+ log . Contents . Add ( "@ Level" , logEvent . Level . ToString ( ) ) ;
56
+ log . Contents . Add ( "@ Message" , logEvent . RenderMessage ( ) ) ;
57
+ log . Contents . Add ( "@MessageTemplate" , logEvent . MessageTemplate . Text ) ;
58
58
59
59
if ( logEvent . Exception != null )
60
60
{
61
- log . Contents . Add ( "Exception" , logEvent . Exception . ToString ( ) ) ;
61
+ log . Contents . Add ( "@ Exception" , logEvent . Exception . ToString ( ) ) ;
62
62
}
63
63
64
64
foreach ( var prop in logEvent . Properties )
65
65
{
66
- log . Contents . Add ( prop . Key , prop . Value . ToString ( ) . Trim ( '"' ) ) ;
66
+ if ( ! log . Contents . ContainsKey ( prop . Key ) )
67
+ {
68
+ log . Contents . Add ( prop . Key , prop . Value . ToString ( ) . Trim ( '"' ) ) ;
69
+ }
70
+ else
71
+ {
72
+ SelfLog . WriteLine ( "Duplicate key: " + prop . Key ) ;
73
+ }
67
74
}
68
75
69
76
logs . Add ( log ) ;
You can’t perform that action at this time.
0 commit comments