예제 #1
0
        public static ILogger <TDataItem> BindToWindsor <TDataItem>(this ILogger <TDataItem> logger, IKernel kernel)
        {
            ILoggerInternal loggerInternal = logger as ILoggerInternal;

            if (loggerInternal == null)
            {
                throw new ArgumentException("logger must implement ILoggerInternal");
            }

            if (!InterceptionEnabled(kernel))
            {
                EnableInterception(kernel);
            }

            ICompositeLoggerInternal compositeLoggerInternal = kernel.Resolve <ICompositeLoggerInternal>();

            if (compositeLoggerInternal.Has((ILoggerInternal)logger))
            {
                throw new InvalidOperationException("Logger already bound");
            }

            compositeLoggerInternal.Add((ILoggerInternal)logger);

            return(logger.SetContainer(new WindsorContainerWrapper(kernel)));
        }
예제 #2
0
 public LoggerInterceptor(ICompositeLoggerInternal compositeLoggerInternal)
 {
     _compositeLoggerInternal = compositeLoggerInternal;
 }
 public LogInterceptorAppenderContributor(ICompositeLoggerInternal compositeLoggerInternal, string loggerInterceptorComponentName)
 {
     _compositeLoggerInternal        = compositeLoggerInternal;
     _loggerInterceptorComponentName = loggerInterceptorComponentName;
 }