File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
src/Serilog.Sinks.Exceptionless/Sinks/Exceptionless Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
+ using System . Linq ;
3
4
using Exceptionless ;
4
5
using Exceptionless . Logging ;
5
6
using Serilog . Core ;
@@ -36,6 +37,24 @@ internal static string GetSource(this LogEvent log) {
36
37
return null ;
37
38
}
38
39
40
+ internal static string [ ] GetTags ( this LogEvent log )
41
+ {
42
+ if ( log . Properties . TryGetValue ( "Tags" , out LogEventPropertyValue value ) )
43
+ {
44
+ var propertyCollection = value . FlattenProperties ( ) as List < object > ;
45
+ if ( propertyCollection == null ) return Array . Empty < string > ( ) ;
46
+
47
+ List < string > tags = new List < string > ( ) ;
48
+ foreach ( var item in propertyCollection )
49
+ {
50
+ tags . Add ( item . ToString ( ) ) ;
51
+ }
52
+
53
+ return tags . ToArray ( ) ;
54
+ }
55
+ return Array . Empty < string > ( ) ;
56
+ }
57
+
39
58
internal static LogLevel GetLevel ( this LogEventLevel log )
40
59
{
41
60
switch ( log )
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ public void Emit(LogEvent logEvent) {
108
108
if ( logEvent . Level . GetLevel ( ) < minLogLevel )
109
109
return ;
110
110
111
- var builder = _client . CreateFromLogEvent ( logEvent ) . AddTags ( _defaultTags ) ;
111
+ var builder = _client . CreateFromLogEvent ( logEvent ) . AddTags ( _defaultTags ) . AddTags ( logEvent . GetTags ( ) ) ;
112
112
113
113
if ( _includeProperties ) {
114
114
foreach ( var prop in logEvent . Properties )
You can’t perform that action at this time.
0 commit comments