Exemplo n.º 1
0
        public FormattingMethodLogger(
            MethodBase targetMethod,
            MethodLoggingSettings settings,
            ILoggerAdapter adapter,
            IIndentationTracker indentationTracker,
            IMethodEventFormatter formatter)
        {
            if (targetMethod == null)
            {
                throw new ArgumentNullException("targetMethod");
            }

            if (adapter == null)
            {
                throw new ArgumentNullException("adapter");
            }

            if (indentationTracker == null)
            {
                throw new ArgumentNullException("indentationTracker");
            }

            if (formatter == null)
            {
                throw new ArgumentNullException("formatter");
            }

            this.targetMethod       = targetMethod;
            this.settings           = settings;
            this.adapter            = adapter;
            this.indentationTracker = indentationTracker;
            this.formatter          = formatter;
        }
Exemplo n.º 2
0
        public IMethodLogger Create(MethodBase targetMethod)
        {
            if (targetMethod == null)
            {
                throw new ArgumentNullException("targetMethod");
            }

            MethodLoggingSettings settings = MethodLoggingSettings.GetForMethod(targetMethod);
            ILoggerAdapter        adapter  = this.LoggerAdapterFactory.Create(targetMethod.DeclaringType);

            return(new FormattingMethodLogger(targetMethod, settings, adapter, this.IndentationTracker, this.MethodEventFormatter));
        }