Exemplo n.º 1
0
        internal LoggingConfiguration(IEnumerable<ILogFilter> filters, IEnumerable<LogSourceData> logSources, SpecialLogSourceData allEventsTraceSource, SpecialLogSourceData notProcessedTraceSource, SpecialLogSourceData errorsTraceSource, string defaultCategory, bool tracingEnabled, bool logWarningsWhenNoCategoriesMatch, bool revertImpersonation)
        {
            if (allEventsTraceSource == null)
            {
                throw new ArgumentNullException("allEventsTraceSource");
            }

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

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

            this.SpecialSources = new SpecialSourcesConfiguration();
            this.SpecialSources.AllEvents = allEventsTraceSource;
            this.SpecialSources.Unprocessed = notProcessedTraceSource;
            this.SpecialSources.LoggingErrorsAndWarnings = errorsTraceSource;

            this.Filters = new List<ILogFilter>(filters);

            this.LogSources = new LogSourceDataCollection(logSources);

            this.DefaultSource = defaultCategory;
            this.IsTracingEnabled = tracingEnabled;
            this.LogWarningsWhenNoCategoriesMatch = logWarningsWhenNoCategoriesMatch;
            this.UseImpersonation = !revertImpersonation;
        }
 /// <summary>
 /// Adds the specified <see cref="TraceListener"/> to the special log source to work asynchronously.
 /// </summary>
 /// <param name="logSource">The special log source to add the trace listener to.</param>
 /// <param name="traceListener">The trace listener to add.</param>
 /// <param name="bufferSize">The size of the buffer for asynchronous requests.</param>
 /// <param name="maxDegreeOfParallelism">The max degree of parallelism for thread safe listeners. Specify <see langword="null"/> to use the current core count.</param>
 /// <param name="disposeTimeout">The timeout for waiting to complete buffered requests when disposing. When <see langword="null" /> the default of <see cref="System.Threading.Timeout.InfiniteTimeSpan" /> is used.</param>
 public static void AddAsynchronousTraceListener(
     this SpecialLogSourceData logSource,
     TraceListener traceListener,
     int?bufferSize             = AsynchronousTraceListenerWrapper.DefaultBufferSize,
     int?maxDegreeOfParallelism = null,
     TimeSpan?disposeTimeout    = null)
 {
     logSource.AddTraceListener(BuildAsynchronousWrapper(traceListener, bufferSize, maxDegreeOfParallelism, disposeTimeout));
 }
 /// <summary>
 /// Adds the specified <see cref="TraceListener"/> to the special log source.
 /// </summary>
 /// <param name="logSource">The special log source to add the trace listener to.</param>
 /// <param name="traceListener">The trace listener to add.</param>
 public static void AddTraceListener(this SpecialLogSourceData logSource, TraceListener traceListener)
 {
     logSource.Listeners.Add(traceListener);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SpecialSourcesConfiguration"/> class.
 /// </summary>
 /// <param name="loggingErrorsAndWarnings">The special log source to which internal errors must be logged.</param>
 /// <param name="unprocessed">The special log source to which log entries with at least one non-matching category should be logged.</param>
 /// <param name="allEvents">The special log source to which all log entries should be logged.</param>
 public SpecialSourcesConfiguration(SpecialLogSourceData loggingErrorsAndWarnings, SpecialLogSourceData unprocessed, SpecialLogSourceData allEvents)
 {
     this.LoggingErrorsAndWarnings = loggingErrorsAndWarnings;
     this.Unprocessed = unprocessed;
     this.AllEvents = allEvents;
 }
        internal LoggingConfiguration(IEnumerable <ILogFilter> filters, IEnumerable <LogSourceData> logSources, SpecialLogSourceData allEventsTraceSource, SpecialLogSourceData notProcessedTraceSource, SpecialLogSourceData errorsTraceSource, string defaultCategory, bool tracingEnabled, bool logWarningsWhenNoCategoriesMatch, bool revertImpersonation)
        {
            if (allEventsTraceSource == null)
            {
                throw new ArgumentNullException("allEventsTraceSource");
            }

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

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

            this.SpecialSources             = new SpecialSourcesConfiguration();
            this.SpecialSources.AllEvents   = allEventsTraceSource;
            this.SpecialSources.Unprocessed = notProcessedTraceSource;
            this.SpecialSources.LoggingErrorsAndWarnings = errorsTraceSource;

            this.Filters = new List <ILogFilter>(filters);

            this.LogSources = new LogSourceDataCollection(logSources);

            this.DefaultSource    = defaultCategory;
            this.IsTracingEnabled = tracingEnabled;
            this.LogWarningsWhenNoCategoriesMatch = logWarningsWhenNoCategoriesMatch;
            this.UseImpersonation = !revertImpersonation;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SpecialSourcesConfiguration"/> class.
 /// </summary>
 /// <param name="loggingErrorsAndWarnings">The special log source to which internal errors must be logged.</param>
 /// <param name="unprocessed">The special log source to which log entries with at least one non-matching category should be logged.</param>
 /// <param name="allEvents">The special log source to which all log entries should be logged.</param>
 public SpecialSourcesConfiguration(SpecialLogSourceData loggingErrorsAndWarnings, SpecialLogSourceData unprocessed, SpecialLogSourceData allEvents)
 {
     this.LoggingErrorsAndWarnings = loggingErrorsAndWarnings;
     this.Unprocessed = unprocessed;
     this.AllEvents   = allEvents;
 }