Mercurial > pub > ImplabNet
comparison Implab/Diagnostics/Log.cs @ 35:2880242f987a diagnostics
initial log capabilities
| author | cin |
|---|---|
| date | Mon, 14 Apr 2014 18:25:26 +0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 34:dabf79fde388 | 35:2880242f987a |
|---|---|
| 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 public static class Log { | |
| 10 [Conditional("TRACE")] | |
| 11 public static void Transfer(LogContext from) { | |
| 12 LogContext.Transfer(from); | |
| 13 } | |
| 14 | |
| 15 [Conditional("TRACE")] | |
| 16 public static void StartLogicalOperation() { | |
| 17 LogContext.Current.StartLogicalOperation(); | |
| 18 } | |
| 19 | |
| 20 [Conditional("TRACE")] | |
| 21 public static void StartLogicalOperation(string name) { | |
| 22 LogContext.Current.StartLogicalOperation(name); | |
| 23 } | |
| 24 | |
| 25 [Conditional("TRACE")] | |
| 26 public static void EndLogicalOperation() { | |
| 27 LogContext.Current.EndLogicalOperation(); | |
| 28 } | |
| 29 | |
| 30 [Conditional("TRACE")] | |
| 31 public static void TraceInformation(string format, params object[] arguments) { | |
| 32 LogContext.Current.TraceEvent(TraceEventType.Information, format, arguments); | |
| 33 } | |
| 34 | |
| 35 [Conditional("TRACE")] | |
| 36 public static void TraceWarning(string format, params object[] arguments) { | |
| 37 LogContext.Current.TraceEvent(TraceEventType.Warning, format, arguments); | |
| 38 } | |
| 39 | |
| 40 [Conditional("TRACE")] | |
| 41 public static void TraceError(string format, params object[] arguments) { | |
| 42 LogContext.Current.TraceEvent(TraceEventType.Error, format, arguments); | |
| 43 } | |
| 44 | |
| 45 [Conditional("TRACE")] | |
| 46 public static void TraceError(Exception err) { | |
| 47 TraceError("{0}", err); | |
| 48 } | |
| 49 } | |
| 50 } |
