public FilterResult ShouldAddTrace(MethodDefinition definition) { //attributes are stronger than patterns var shouldTrace = _traceAttributeHelper.ShouldTraceBasedOnMethodLevelInfo(definition) ?? _traceAttributeHelper.ShouldTraceBasedOnClassLevelInfo(definition); if (shouldTrace.HasValue) { return(shouldTrace.Value); } foreach (var patternDefinition in _patternDefinitions) { if (patternDefinition.IsMatching(definition)) { return(new FilterResult(patternDefinition.TraceEnabled, patternDefinition.Parameters)); } } //defaults to public methods of public classes only var result = (definition.IsPublic && definition.DeclaringType.IsPublic && !definition.IsConstructor && !definition.IsSetter && !definition.IsGetter); return(new FilterResult(result)); }
public FilterResult ShouldAddTrace(MethodDefinition definition) { //Trace attribute defined closer to the method overrides more generic definitions //So the check order is method -> class -> outer class -> assembly level specs return(_traceAttributeHelper.ShouldTraceBasedOnMethodLevelInfo(definition) ?? _traceAttributeHelper.ShouldTraceBasedOnClassLevelInfo(definition) ?? ShouldTraceBasedOnAssemblyLevelInfo(definition)); }