@@ -152,6 +152,10 @@ public void EventExclusionPlugin_EventExclusions() {
152
152
[ InlineData ( "Test" , "Trace" , null , null , false ) ]
153
153
[ InlineData ( "Test" , "Off" , null , null , true ) ]
154
154
[ InlineData ( "Test" , "Abc" , null , null , false ) ]
155
+ [ InlineData ( null , "Trace" , SettingsDictionary . KnownKeys . LogLevelPrefix , "Off" , false ) ]
156
+ [ InlineData ( null , "Trace" , SettingsDictionary . KnownKeys . LogLevelPrefix + "*" , "Off" , true ) ]
157
+ [ InlineData ( "" , "Trace" , SettingsDictionary . KnownKeys . LogLevelPrefix , "Off" , true ) ] // Becomes Global Log Level
158
+ [ InlineData ( "" , "Trace" , SettingsDictionary . KnownKeys . LogLevelPrefix + "*" , "Off" , true ) ]
155
159
[ InlineData ( "Test" , "Trace" , SettingsDictionary . KnownKeys . LogLevelPrefix + "Test" , "Debug" , true ) ]
156
160
[ InlineData ( "Test" , "Trace" , SettingsDictionary . KnownKeys . LogLevelPrefix + "Test" , "false" , true ) ]
157
161
[ InlineData ( "Test" , "Trace" , SettingsDictionary . KnownKeys . LogLevelPrefix + "Test" , "no" , true ) ]
@@ -178,6 +182,43 @@ public void EventExclusionPlugin_LogLevels(string source, string level, string s
178
182
Assert . Equal ( cancelled , context . Cancel ) ;
179
183
}
180
184
185
+ [ Fact ]
186
+ public void EventExclusionPlugin_LogLevels_GetMinLogLevel_Settings_Order ( ) {
187
+ var settings = new SettingsDictionary { { "@@log:" , "Info" } , { "@@log:*" , "Debug" } } ;
188
+ Assert . Equal ( LogLevel . Debug , settings . GetMinLogLevel ( null ) ) ;
189
+ Assert . Equal ( LogLevel . Info , settings . GetMinLogLevel ( String . Empty ) ) ;
190
+ Assert . Equal ( LogLevel . Debug , settings . GetMinLogLevel ( "*" ) ) ;
191
+
192
+ settings = new SettingsDictionary { { "@@log:*" , "Debug" } , { "@@log:" , "Info" } } ;
193
+ Assert . Equal ( LogLevel . Info , settings . GetMinLogLevel ( String . Empty ) ) ;
194
+ Assert . Equal ( LogLevel . Debug , settings . GetMinLogLevel ( "*" ) ) ;
195
+
196
+ settings = new SettingsDictionary {
197
+ { "@@log:*" , "Fatal" } ,
198
+ { "@@log:" , "Debug" } ,
199
+ { "@@log:abc*" , "Off" } ,
200
+ { "@@log:abc.de*" , "Debug" } ,
201
+ { "@@log:abc.def*" , "Info" } ,
202
+ { "@@log:abc.def.ghi" , "Trace" }
203
+ } ;
204
+
205
+ Assert . Equal ( LogLevel . Fatal , settings . GetMinLogLevel ( null ) ) ;
206
+ Assert . Equal ( LogLevel . Debug , settings . GetMinLogLevel ( String . Empty ) ) ;
207
+ Assert . Equal ( LogLevel . Off , settings . GetMinLogLevel ( "abc" ) ) ;
208
+ Assert . Equal ( LogLevel . Info , settings . GetMinLogLevel ( "abc.def" ) ) ;
209
+ Assert . Equal ( LogLevel . Trace , settings . GetMinLogLevel ( "abc.def.ghi" ) ) ;
210
+
211
+ settings = new SettingsDictionary {
212
+ { "@@log:abc.def.ghi" , "Trace" } ,
213
+ { "@@log:abc.def*" , "Info" } ,
214
+ { "@@log:abc*" , "Off" }
215
+ } ;
216
+
217
+ Assert . Equal ( LogLevel . Off , settings . GetMinLogLevel ( "abc" ) ) ;
218
+ Assert . Equal ( LogLevel . Info , settings . GetMinLogLevel ( "abc.def" ) ) ;
219
+ Assert . Equal ( LogLevel . Trace , settings . GetMinLogLevel ( "abc.def.ghi" ) ) ;
220
+ }
221
+
181
222
[ Theory ]
182
223
[ InlineData ( null , null , null , null , false ) ]
183
224
[ InlineData ( "usage" , null , null , null , false ) ]
@@ -186,6 +227,9 @@ public void EventExclusionPlugin_LogLevels(string source, string level, string s
186
227
[ InlineData ( "usage" , "test" , "@@usage:Test" , "false" , true ) ]
187
228
[ InlineData ( "usage" , "EX-FEAT: 1234567890" , "@@usage:EX-FEAT: 1234567890" , "false" , true ) ]
188
229
[ InlineData ( "usage" , "test" , "@@usage:*" , "false" , true ) ]
230
+ [ InlineData ( "404" , null , "@@404:*" , "false" , true ) ]
231
+ [ InlineData ( "404" , null , "@@404:" , "false" , true ) ]
232
+ [ InlineData ( "404" , "" , "@@404:" , "false" , true ) ]
189
233
[ InlineData ( "404" , "/unknown" , "@@404:*" , "false" , true ) ]
190
234
[ InlineData ( "404" , "/unknown" , "@@404:/unknown" , "false" , true ) ]
191
235
[ InlineData ( "404" , "/unknown" , "@@404:/unknown" , "true" , false ) ]
@@ -200,6 +244,7 @@ public void EventExclusionPlugin_SourceType(string type, string source, string s
200
244
var plugin = new EventExclusionPlugin ( ) ;
201
245
plugin . Run ( context ) ;
202
246
Assert . Equal ( cancelled , context . Cancel ) ;
247
+ Assert . Equal ( source , ev . Source ) ;
203
248
}
204
249
205
250
[ Theory ]
0 commit comments