Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PerformanceTracer"/> class with the given logical operation name and activity id.
        /// </summary>
        /// <remarks>
        /// The activity id will override a previous activity id
        /// </remarks>
        /// <param name="operation">The operation for the <see cref="PerformanceTracer"/></param>
        /// <param name="activityId">The activity id</param>
        /// <param name="writer">The <see cref="IPerformanceWriter"/> that is used to write trace messages</param>
        public PerformanceTracer(string operation, Guid activityId, IPerformanceWriter writer)
        {
            if (CheckTracingAvailable())
            {
                if (writer == null)
                {
                    throw new ArgumentNullException("writer");
                }

                SetActivityId(activityId);

                _writer = writer;

                Initialize(operation);
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PerformanceTracer"/> class with the given logical operation name.
        /// </summary>
        /// <remarks>
        /// If an existing activity id is already set, it will be kept. Otherwise, a new activity id will be created.
        /// </remarks>
        /// <param name="operation">The operation for the <see cref="PerformanceTracer"/></param>
        /// <param name="writer">The <see cref="IPerformanceWriter"/> that is used to write trace messages</param>
        public PerformanceTracer(string operation, IPerformanceWriter writer)
        {
            if (CheckTracingAvailable())
            {
                if (writer == null)
                {
                    throw new ArgumentNullException("writer");
                }

                _writer = writer;

                if (GetActivityId().Equals(Guid.Empty))
                {
                    SetActivityId(Guid.NewGuid());
                }

                Initialize(operation);
            }
        }
Exemple #3
0
 private IPerformanceWriter GetWriter()
 {
     return(_writer ?? (_writer = new DebugPerformanceWriter()));
 }