Exemplo n.º 1
0
        /// <summary>
        /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code.
        /// Initializes a new instance of the <see cref="MsgWriterStructureHolder"/> class.
        /// </summary>
        /// <param name="filters">The collection of filters to use when processing an entry.</param>
        /// <param name="traceSources">The trace sources to dispatch entries to.</param>
        /// <param name="allEventsTraceSource">The special <see cref="MsgSource"/> to which all log entries should be logged.</param>
        /// <param name="notProcessedTraceSource">The special <see cref="MsgSource"/> to which log entries with at least one non-matching category should be logged.</param>
        /// <param name="errorsTraceSource">The special <see cref="MsgSource"/> to which internal errors must be logged.</param>
        /// <param name="defaultCategory">The default category to set when entry categories list of a log entry is empty.</param>
        /// <param name="tracingEnabled">The tracing status.</param>
        /// <param name="logWarningsWhenNoCategoriesMatch">true if warnings should be logged when a non-matching category is found.</param>
        /// <param name="revertImpersonation">true if impersonation should be reverted while logging.</param>
        public MsgWriterStructureHolder(
            IEnumerable<IMsgFilter> filters,
            IDictionary<string, MsgSource> traceSources,
            MsgSource allEventsTraceSource,
            MsgSource notProcessedTraceSource,
            MsgSource errorsTraceSource,
            string defaultCategory,
            bool tracingEnabled,
            bool logWarningsWhenNoCategoriesMatch,
            bool revertImpersonation)
        {
            if (filters == null)
                throw new ArgumentNullException("filters");
            if (traceSources == null)
                throw new ArgumentNullException("traceSources");
            if (errorsTraceSource == null)
                throw new ArgumentNullException("errorsTraceSource");

            this.filters = filters;
            this.traceSources = traceSources;
            this.allEventsTraceSource = allEventsTraceSource;
            this.notProcessedTraceSource = notProcessedTraceSource;
            this.errorsTraceSource = errorsTraceSource;
            this.defaultCategory = defaultCategory;
            this.tracingEnabled = tracingEnabled;
            this.logWarningsWhenNoCategoriesMatch = logWarningsWhenNoCategoriesMatch;
            this.revertImpersonation = revertImpersonation;
        }
Exemplo n.º 2
0
 private void DisposeSpecialLogSource(MsgSource specialLogSource)
 {
     if (specialLogSource != null)
     {
         specialLogSource.Dispose();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// This constructor supports the Enterprise Library infrastructure and is not intended to be used directly from your code.
 /// Initializes a new instance of the <see cref="MsgWriterStructureHolder"/> class.
 /// </summary>
 /// <param name="filters">The collection of filters to use when processing an entry.</param>
 /// <param name="traceSourceNames">Names of the trace sources to dispatch entries to.</param>
 /// <param name="traceSources">The trace sources to dispatch entries to.</param>
 /// <param name="allEventsTraceSource">The special <see cref="MsgSource"/> to which all log entries should be logged.</param>
 /// <param name="notProcessedTraceSource">The special <see cref="MsgSource"/> to which log entries with at least one non-matching category should be logged.</param>
 /// <param name="errorsTraceSource">The special <see cref="MsgSource"/> to which internal errors must be logged.</param>
 /// <param name="defaultCategory">The default category to set when entry categories list of a log entry is empty.</param>
 /// <param name="tracingEnabled">The tracing status.</param>
 /// <param name="logWarningsWhenNoCategoriesMatch">true if warnings should be logged when a non-matching category is found.</param>
 /// <param name="revertImpersonation">true if impersonation should be reverted while logging.</param>
 public MsgWriterStructureHolder(
     IEnumerable<IMsgFilter> filters,
     IEnumerable<string> traceSourceNames,
     IEnumerable<MsgSource> traceSources,
     MsgSource allEventsTraceSource,
     MsgSource notProcessedTraceSource,
     MsgSource errorsTraceSource,
     string defaultCategory,
     bool tracingEnabled,
     bool logWarningsWhenNoCategoriesMatch,
     bool revertImpersonation)
     : this(filters, 
         traceSourceNames.ToDictionary(traceSources), 
         allEventsTraceSource, 
         notProcessedTraceSource, 
         errorsTraceSource,
         defaultCategory,
         tracingEnabled,
         logWarningsWhenNoCategoriesMatch,
         revertImpersonation)
 {
 }