comparison Implab/Diagnostics/TraceLog.cs @ 36:313f708a50e9 diagnostics

improved log concept
author cin
date Tue, 15 Apr 2014 02:00:09 +0400
parents
children fe33f4e02ad5
comparison
equal deleted inserted replaced
35:2880242f987a 36:313f708a50e9
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>
10 /// Класс для публикации событий выполнения программы, события публикуются через <see cref="LogChannel{TraceEvent}"/>
11 /// </summary>
12 public static class TraceLog {
13 [Conditional("TRACE")]
14 public static void Transfer(TraceContext from) {
15 TraceContext.Transfer(from);
16 }
17
18 [Conditional("TRACE")]
19 public static void StartLogicalOperation() {
20 TraceContext.Current.StartLogicalOperation();
21 }
22
23 [Conditional("TRACE")]
24 public static void StartLogicalOperation(string name) {
25 TraceContext.Current.StartLogicalOperation(name);
26 }
27
28 [Conditional("TRACE")]
29 public static void EndLogicalOperation() {
30 TraceContext.Current.EndLogicalOperation();
31 }
32
33 [Conditional("TRACE")]
34 public static void TraceInformation(string format, params object[] arguments) {
35 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceEventType.Information, format, arguments));
36 }
37
38 [Conditional("TRACE")]
39 public static void TraceWarning(string format, params object[] arguments) {
40 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceEventType.Warning, format, arguments));
41 }
42
43 [Conditional("TRACE")]
44 public static void TraceError(string format, params object[] arguments) {
45 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceEventType.Error, format, arguments));
46 }
47
48 [Conditional("TRACE")]
49 public static void TraceError(Exception err) {
50 TraceError("{0}", err);
51 }
52 }
53 }