/// <summary> /// Initializes a new instance of the <see cref="Tracer"/> class with the given logical operation name and activity id. /// </summary> /// <remarks> /// This is meant to be used internally /// </remarks> /// <param name="operation">The operation for the <see cref="Tracer"/></param> /// <param name="writer">The <see cref="LogWriter"/> that is used to write trace messages</param> /// <param name="instrumentationProvider">Instrumentation provider to use for firing logical instrumentation events from Tracer.</param> /// <exception cref="ArgumentNullException"></exception> internal Tracer(string operation, LogWriter writer, ITracerInstrumentationProvider instrumentationProvider) { this.instrumentationProvider = instrumentationProvider; if (CheckTracingAvailable()) { if (writer == null) { throw new ArgumentNullException("writer", Resources.ExceptionWriterShouldNotBeNull); } if (GetActivityId().Equals(Guid.Empty)) { this.previousActivityId = Guid.Empty; SetActivityId(Guid.NewGuid()); } else { this.previousActivityId = null; } this.writer = writer; Initialize(operation); } }
/// <summary> /// Create an instance of <see cref="TraceManager"/> giving the <see cref="LogWriter"/>. /// </summary> /// <param name="logWriter">The <see cref="LogWriter"/> that is used to write trace messages.</param> /// <param name="instrumentationProvider">The <see cref="ITracerInstrumentationProvider"/> used to determine if instrumentation should be enabled</param> public TraceManager(MsgWriter logWriter, ITracerInstrumentationProvider instrumentationProvider) { if (logWriter == null) { throw new ArgumentNullException("logWriter"); } this.logWriter = logWriter; this.instrumentationProvider = instrumentationProvider; }
/// <summary> /// Create an instance of <see cref="TraceManager"/> giving the <see cref="LogWriter"/>. /// </summary> /// <param name="logWriter">The <see cref="LogWriter"/> that is used to write trace messages.</param> /// <param name="instrumentationProvider">The <see cref="ITracerInstrumentationProvider"/> used to determine if instrumentation should be enabled</param> public TraceManager(LogWriter logWriter, ITracerInstrumentationProvider instrumentationProvider) { if (logWriter == null) { throw new ArgumentNullException("logWriter"); } this.logWriter = logWriter; this.instrumentationProvider = instrumentationProvider; }
public void SetUp() { nameFormatter = new AppDomainNameFormatter(applicationInstanceName); instrumentationProvider = new LoggingInstrumentationProvider(instanceName, true, true, applicationInstanceName); tracerInstrumentationProvider = new TracerInstrumentationProvider(true, false, string.Empty); formattedInstanceName = nameFormatter.CreateName(instanceName); totalLoggingEventsRaised = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalLoggingEventsRaised, formattedInstanceName); totalTraceListenerEntriesWritten = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalTraceListenerEntriesWritten, formattedInstanceName); // Use AppDomainFriendlyName for the instance name nameFormatter = new AppDomainNameFormatter(); formattedInstanceName = nameFormatter.CreateName(instanceName); totalTraceOperationsStartedCounter = new EnterpriseLibraryPerformanceCounter(TracerInstrumentationProvider.counterCategoryName, TracerInstrumentationProvider.TotalTraceOperationsStartedCounterName, formattedInstanceName); }
/// <summary> /// Initializes a new instance of the <see cref="Tracer"/> class with the given logical operation name and activity id. /// </summary> /// <remarks> /// This is meant to be used internally /// </remarks> /// <param name="operation">The operation for the <see cref="Tracer"/></param> /// <param name="activityId">The activity id</param> /// <param name="writer">The <see cref="LogWriter"/> that is used to write trace messages</param> /// <param name="instrumentationProvider">Instrumentation provider to use for firing logical instrumentation events from Tracer.</param> /// <exception cref="ArgumentNullException"></exception> internal Tracer(string operation, Guid activityId, LogWriter writer, ITracerInstrumentationProvider instrumentationProvider) { this.instrumentationProvider = instrumentationProvider; if (CheckTracingAvailable()) { if (writer == null) { throw new ArgumentNullException("writer", Resources.ExceptionWriterShouldNotBeNull); } this.previousActivityId = GetActivityId(); SetActivityId(activityId); this.writer = writer; Initialize(operation); } }
/// <summary> /// Initializes a new instance of the <see cref="Tracer"/> class with the given logical operation name and activity id. /// </summary> /// <remarks> /// This is meant to be used internally /// </remarks> /// <param name="operation">The operation for the <see cref="Tracer"/></param> /// <param name="writer">The <see cref="MsgWriter"/> that is used to write trace messages</param> /// <param name="instrumentationProvider">Instrumentation provider to use for firing logical instrumentation events from Tracer.</param> /// <exception cref="ArgumentNullException"></exception> internal Tracer(string operation, MsgWriter writer, ITracerInstrumentationProvider instrumentationProvider) { this.instrumentationProvider = instrumentationProvider; if (CheckTracingAvailable()) { if (writer == null) throw new ArgumentNullException("writer", Resources.ExceptionWriterShouldNotBeNull); if (GetActivityId().Equals(Guid.Empty)) { this.previousActivityId = Guid.Empty; SetActivityId(Guid.NewGuid()); } else { this.previousActivityId = null; } this.writer = writer; Initialize(operation); } }
/// <summary> /// Initializes a new instance of the <see cref="Tracer"/> class with the given logical operation name and activity id. /// </summary> /// <remarks> /// This is meant to be used internally /// </remarks> /// <param name="operation">The operation for the <see cref="Tracer"/></param> /// <param name="activityId">The activity id</param> /// <param name="writer">The <see cref="MsgWriter"/> that is used to write trace messages</param> /// <param name="instrumentationProvider">Instrumentation provider to use for firing logical instrumentation events from Tracer.</param> /// <exception cref="ArgumentNullException"></exception> internal Tracer(string operation, Guid activityId, MsgWriter writer, ITracerInstrumentationProvider instrumentationProvider) { this.instrumentationProvider = instrumentationProvider; if (CheckTracingAvailable()) { if (writer == null) throw new ArgumentNullException("writer", Resources.ExceptionWriterShouldNotBeNull); this.previousActivityId = GetActivityId(); SetActivityId(activityId); this.writer = writer; Initialize(operation); } }