/// <summary> /// Initializes a new instance of the <see cref="LogSource"/> class with a name, a collection of <see cref="TraceListener"/>s and a level. /// </summary> /// <param name="name">The name for the instance.</param> /// <param name="traceListeners">The collection of <see cref="TraceListener"/>s.</param> /// <param name="level">The <see cref="SourceLevels"/> value.</param> public LogSource(string name, List <TraceListener> traceListeners, SourceLevels level) { this.name = name; this.traceListeners = traceListeners; this.level = level; this.instrumentationProvider = new LoggingInstrumentationProvider(); }
internal LogWriter(LogWriterStructureHolder structureHolder, ILogWriterStructureUpdater structureUpdater) { this.structureHolder = structureHolder; this.filter = new LogFilterHelper(structureHolder.Filters, this); this.structureUpdater = structureUpdater; instrumentationProvider = new LoggingInstrumentationProvider(); }
public void EventLogWrittenWhenDeliveryToErrorSourceFails() { TraceListener badTraceListener = new BadTraceListener(new Exception("test exception")); LogSource badSource = new LogSource("badSource"); badSource.Listeners.Add(badTraceListener); Dictionary <string, LogSource> logSources = new Dictionary <string, LogSource>(); logSources.Add("foo", badSource); ILoggingInstrumentationProvider instrumentationProvider = new LoggingInstrumentationProvider(false, true, "applicationInstanceName"); LogWriter writer = new LogWriterImpl(new List <ILogFilter>(), logSources, badSource, "foo", instrumentationProvider); writer.Write(CommonUtil.GetDefaultLogEntry()); string lastEventLogEntry = CommonUtil.GetLastEventLogEntry(); Assert.IsTrue(-1 != lastEventLogEntry.IndexOf("test exception")); }
public WmiTraceListener() : base() { instrumentationProvider = new LoggingInstrumentationProvider(); }
/// <summary> /// Initializes a new instance of <see cref="FormattedTextWriterTraceListener"/> with a <see cref="TextWriter"/>. /// </summary> /// <param name="writer">The writer to write to.</param> public FormattedTextWriterTraceListener(TextWriter writer) : base(writer) { instrumentationProvider = new LoggingInstrumentationProvider(); }
/// <summary> /// Initializes a new instance of <see cref="FormattedTextWriterTraceListener"/> with a <see cref="Stream"/>. /// </summary> /// <param name="stream">The stream to write to.</param> public FormattedTextWriterTraceListener(Stream stream) : base(stream) { instrumentationProvider = new LoggingInstrumentationProvider(); }
/// <summary> /// Initializes a new named instance of <see cref="FormattedTextWriterTraceListener"/> with a file name. /// </summary> /// <param name="fileName">The file name to write to.</param> /// <param name="name">The name.</param> public FormattedTextWriterTraceListener(string fileName, string name) : base(RootFileNameAndEnsureTargetFolderExists(fileName), name) { instrumentationProvider = new LoggingInstrumentationProvider(); }
/// <summary> /// Initializes a new instance of the <see cref="RollingFormattedTextWriterTraceListener" /> class. /// </summary> /// <param name="fileName">Log filename</param> public RollingFormattedTextWriterTraceListener(String fileName) : base(RootFileNameAndEnsureTargetFolderExists(fileName)) { mInstrumentationProvider = new LoggingInstrumentationProvider(); }
/// <summary> /// Initalizes a new instance of <see cref="FormattedTraceListenerBase"/> with a <see cref="ILogFormatter"/>. /// </summary> /// <param name="formatter">The <see cref="ILogFormatter"/> to use when tracing a <see cref="LogEntry"/>.</param> public FormattedTraceListenerBase(ILogFormatter formatter) { this.Formatter = formatter; instrumentationProvider = new LoggingInstrumentationProvider(); }
/// <summary> /// Initalizes a new instance of <see cref="FormattedTraceListenerBase"/>. /// </summary> public FormattedTraceListenerBase() { instrumentationProvider = new LoggingInstrumentationProvider(); }
public void Setup() { this.provider = new LoggingInstrumentationProvider(false, false, "application"); }