public LoggingInterceptor(ILog log, bool logExceptions, OnBeforeExecution onBeforeExecution, OnAfterExecution onAfterExecution) { _log = log; _logExceptions = logExceptions; _onBeforeExecution = onBeforeExecution; _onAfterExecution = onAfterExecution; }
public static TInterface CreateInterfaceLogger <TInterface, TImplementation>(this ILog log, TImplementation instance, bool logExceptions = true, OnBeforeExecution onBeforeExecution = null, OnAfterExecution onAfterExecution = null) where TImplementation : TInterface { if (instance == null) { throw new ArgumentNullException(nameof(instance)); } var interceptor = new LoggingInterceptor(log, logExceptions, onBeforeExecution, onAfterExecution); return((TInterface)PG.CreateInterfaceProxyWithTarget(typeof(TInterface), instance, interceptor)); }