36
|
1 using System;
|
|
2 using System.Collections.Generic;
|
|
3 using System.Diagnostics;
|
|
4 using System.Linq;
|
|
5 using System.Text;
|
|
6 using System.Threading.Tasks;
|
|
7
|
|
8 namespace Implab.Diagnostics {
|
|
9 /// <summary>
|
40
|
10 /// Класс для публикации событий выполнения программы, события публикуются через <see cref="LogChannel{TraceEvent}"/>.
|
|
11 /// Журнал трассировки отражает логический ход выполнения программы и существует всегда, поскольку тесно связан с
|
|
12 /// контекстом трассировки.
|
36
|
13 /// </summary>
|
|
14 public static class TraceLog {
|
|
15 [Conditional("TRACE")]
|
|
16 public static void StartLogicalOperation() {
|
|
17 TraceContext.Current.StartLogicalOperation();
|
|
18 }
|
|
19
|
|
20 [Conditional("TRACE")]
|
|
21 public static void StartLogicalOperation(string name) {
|
|
22 TraceContext.Current.StartLogicalOperation(name);
|
|
23 }
|
|
24
|
|
25 [Conditional("TRACE")]
|
|
26 public static void EndLogicalOperation() {
|
|
27 TraceContext.Current.EndLogicalOperation();
|
|
28 }
|
|
29
|
|
30 [Conditional("TRACE")]
|
66
|
31 public static void BindLogicalOperationToPromise(IPromise promise) {
|
52
|
32 TraceContext.Current.BindLogicalOperationToPromise(promise);
|
|
33 }
|
|
34
|
|
35 [Conditional("TRACE")]
|
36
|
36 public static void TraceInformation(string format, params object[] arguments) {
|
|
37 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceEventType.Information, format, arguments));
|
|
38 }
|
|
39
|
|
40 [Conditional("TRACE")]
|
|
41 public static void TraceWarning(string format, params object[] arguments) {
|
|
42 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceEventType.Warning, format, arguments));
|
|
43 }
|
|
44
|
|
45 [Conditional("TRACE")]
|
|
46 public static void TraceError(string format, params object[] arguments) {
|
|
47 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceEventType.Error, format, arguments));
|
|
48 }
|
|
49
|
|
50 [Conditional("TRACE")]
|
|
51 public static void TraceError(Exception err) {
|
|
52 TraceError("{0}", err);
|
|
53 }
|
|
54 }
|
|
55 }
|