I am trying to create Audit logs for every controller so that I can keep track of invoked Actions. I am using .net core and Castle Core Dynamic Proxy.
class AuditInterceptor : IInterceptor
{
private readonly IAuditingHelper _auditingHelper;
public AuditingInterceptor(IAuditingHelper auditingHelper)
{
_auditingHelper = auditingHelper;
}
public void Intercept(IInvocation invocation)
{
invocation..Proceed();
log.info(audit); // elided
}
}
How can I intercept every Controller ? I can use Simple injector or Autofac.
The reason I am not interested in Filters is that I have 4500 actions. I dont want to decorate them all.