You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicclassLogAttribute:MethodInterceptorAttribute{}// You must specify the attribute type for the interceptor.[InterceptFor(typeof(LogAttribute))]publicclassLogInterceptor:MethodInterceptor{privatereadonlyLoggerlogger;// The Logger dependency will be resolved using Microsoft's DI containerpublicLogInterceptor(Loggerlogger){this.logger=logger;}// MethodInterceptor class provides OnBefore, OnAfter and OnError methods.// You can override these methods to seperate the logic you don't want in your actual method.publicoverrideTaskOnBefore(IInvocationinvocation){logger.LogInfo($"[Log] Executing method: {invocation.TargetType.FullName}.{invocation.Method.Name}");returnTask.FromResult(Task.CompletedTask);}}