Mercurial > pub > ImplabNet
diff Implab/Diagnostics/Trace.cs @ 252:6f4630d0bcd9 v3
removed absolete Diagnostics classes
author | cin |
---|---|
date | Mon, 12 Feb 2018 07:24:31 +0300 |
parents | babe55c34931 |
children | 34df34841225 |
line wrap: on
line diff
--- a/Implab/Diagnostics/Trace.cs Sun Feb 11 00:49:51 2018 +0300 +++ b/Implab/Diagnostics/Trace.cs Mon Feb 12 07:24:31 2018 +0300 @@ -8,10 +8,10 @@ namespace Implab.Diagnostics { public static class Trace<T> { - readonly static LogChannel<TraceEvent> _channel = new LogChannel<TraceEvent>(typeof(T).Name); - - public static LogChannel<TraceEvent> Channel { - get { return _channel; } + readonly static TraceSource _traceSource = new TraceSource(typeof(T).Name); + + public static TraceSource TraceSource { + get { return _traceSource; } } /// <summary> @@ -19,7 +19,7 @@ /// </summary> [Conditional("TRACE")] public static void StartLogicalOperation() { - TraceContext.Instance.StartLogicalOperation(); + Trace.CorrelationManager.StartLogicalOperation(); } @@ -29,17 +29,15 @@ /// <param name="name">Name.</param> [Conditional("TRACE")] public static void StartLogicalOperation(string name) { - Channel.LogEvent(new TraceEvent(TraceContext.Instance.CurrentOperation, TraceEventType.OperationStarted, name)); - TraceContext.Instance.StartLogicalOperation(name); + Trace.CorrelationManager.StartLogicalOperation(); } /// <summary> /// Ends the logical operation and restores the previous one. /// </summary> [Conditional("TRACE")] - public static void EndLogicalOperation() { - var op = TraceContext.Instance.EndLogicalOperation(); - Channel.LogEvent(new TraceEvent(op, TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms", op.Name, op.Duration))); + public static void StopLogicalOperation() { + Trace.CorrelationManager.StopLogicalOperation(); } /// <summary> @@ -49,7 +47,7 @@ /// <param name="arguments">Arguments.</param> [Conditional("TRACE")] public static void Log(string format, params object[] arguments) { - Channel.LogEvent(TraceEvent.Create(TraceContext.Instance.CurrentOperation, TraceEventType.Information, format, arguments)); + TraceSource.TraceEvent(TraceEventType.Information, 1, format, arguments); } /// <summary> @@ -59,17 +57,17 @@ /// <param name="arguments">Arguments.</param> [Conditional("TRACE")] public static void Warn(string format, params object[] arguments) { - Channel.LogEvent(TraceEvent.Create(TraceContext.Instance.CurrentOperation, TraceEventType.Warning, format, arguments)); + TraceSource.TraceEvent(TraceEventType.Warning, 1, format, arguments); } [Conditional("TRACE")] public static void Error(string format, params object[] arguments) { - Channel.LogEvent(TraceEvent.Create(TraceContext.Instance.CurrentOperation, TraceEventType.Error, format, arguments)); + TraceSource.TraceEvent(TraceEventType.Error, 1, format, arguments); } [Conditional("TRACE")] public static void Error(Exception err) { - Error("{0}", err); + TraceSource.TraceData(TraceEventType.Error, 1, err); } } }