Mercurial > pub > ImplabNet
annotate 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 |
rev | line source |
---|---|
212
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
1 using System; |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
2 using System.Collections.Generic; |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
3 using System.Diagnostics; |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
4 using System.Linq; |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
5 using System.Text; |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
6 using System.Threading.Tasks; |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
7 |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
8 namespace Implab.Diagnostics { |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
9 public static class Trace<T> { |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
10 |
252 | 11 readonly static TraceSource _traceSource = new TraceSource(typeof(T).Name); |
12 | |
13 public static TraceSource TraceSource { | |
14 get { return _traceSource; } | |
212
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
15 } |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
16 |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
17 /// <summary> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
18 /// Starts the logical operation nested to the current operation nested to the current one. |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
19 /// </summary> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
20 [Conditional("TRACE")] |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
21 public static void StartLogicalOperation() { |
252 | 22 Trace.CorrelationManager.StartLogicalOperation(); |
212
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
23 |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
24 } |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
25 |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
26 /// <summary> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
27 /// Starts the logical operation with the specified name, this name is usefull in logs. |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
28 /// </summary> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
29 /// <param name="name">Name.</param> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
30 [Conditional("TRACE")] |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
31 public static void StartLogicalOperation(string name) { |
252 | 32 Trace.CorrelationManager.StartLogicalOperation(); |
212
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
33 } |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
34 |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
35 /// <summary> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
36 /// Ends the logical operation and restores the previous one. |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
37 /// </summary> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
38 [Conditional("TRACE")] |
252 | 39 public static void StopLogicalOperation() { |
40 Trace.CorrelationManager.StopLogicalOperation(); | |
212
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
41 } |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
42 |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
43 /// <summary> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
44 /// Writes an informational message. |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
45 /// </summary> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
46 /// <param name="format">Format.</param> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
47 /// <param name="arguments">Arguments.</param> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
48 [Conditional("TRACE")] |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
49 public static void Log(string format, params object[] arguments) { |
252 | 50 TraceSource.TraceEvent(TraceEventType.Information, 1, format, arguments); |
212
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
51 } |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
52 |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
53 /// <summary> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
54 /// Writes a warning message. |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
55 /// </summary> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
56 /// <param name="format">Format.</param> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
57 /// <param name="arguments">Arguments.</param> |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
58 [Conditional("TRACE")] |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
59 public static void Warn(string format, params object[] arguments) { |
252 | 60 TraceSource.TraceEvent(TraceEventType.Warning, 1, format, arguments); |
212
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
61 } |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
62 |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
63 [Conditional("TRACE")] |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
64 public static void Error(string format, params object[] arguments) { |
252 | 65 TraceSource.TraceEvent(TraceEventType.Error, 1, format, arguments); |
212
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
66 } |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
67 |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
68 [Conditional("TRACE")] |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
69 public static void Error(Exception err) { |
252 | 70 TraceSource.TraceData(TraceEventType.Error, 1, err); |
212
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
71 } |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
72 } |
a01d9df88d74
Added class Trace<T> to manage channels for individual classes, if SomeClass
cin
parents:
diff
changeset
|
73 } |