##// END OF EJS Templates
Bound promise to CancellationToken...
Bound promise to CancellationToken Added new states to ExecutionSate enum. Added Safe.Guard() method to handle cleanup of the result of the promise

File last commit:

r200:71e543dbe65a v2
r209:a867536c68fc v2
Show More
TraceLog.cs
70 lines | 2.8 KiB | text/x-csharp | CSharpLexer
cin
improved log concept
r36 using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Implab.Diagnostics {
/// <summary>
cin
minor changes
r195 /// This class is used to trace a logical flow of the application, it publishes events to the default <see cref="TraceEvent"/> channel.
cin
improved log concept
r36 /// </summary>
public static class TraceLog {
cin
minor changes
r195 /// <summary>
/// Starts the logical operation nested to the current operation nested to the current one.
/// </summary>
cin
improved log concept
r36 [Conditional("TRACE")]
public static void StartLogicalOperation() {
cin
rewritten tracing
r92 TraceContext.Instance.StartLogicalOperation();
cin
minor changes
r195
cin
improved log concept
r36 }
cin
minor changes
r195 /// <summary>
/// Starts the logical operation with the specified name, this name is usefull in logs.
/// </summary>
/// <param name="name">Name.</param>
cin
improved log concept
r36 [Conditional("TRACE")]
public static void StartLogicalOperation(string name) {
cin
rewritten tracing
r92 TraceContext.Instance.StartLogicalOperation(name);
cin
improved log concept
r36 }
cin
minor changes
r195 /// <summary>
/// Ends the logical operation and restores the previous one.
/// </summary>
cin
improved log concept
r36 [Conditional("TRACE")]
public static void EndLogicalOperation() {
cin
minor changes
r195 var op = TraceContext.Instance.EndLogicalOperation();
cin
working version of the project
r200 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(op, TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms",op.Name, op.Duration)));
cin
improved trace system
r52 }
cin
minor changes
r195 /// <summary>
/// Writes an informational message.
/// </summary>
/// <param name="format">Format.</param>
/// <param name="arguments">Arguments.</param>
cin
improved trace system
r52 [Conditional("TRACE")]
cin
improved log concept
r36 public static void TraceInformation(string format, params object[] arguments) {
cin
working version of the project
r200 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceContext.Instance.CurrentOperation, TraceEventType.Information, format, arguments));
cin
improved log concept
r36 }
cin
minor changes
r195 /// <summary>
/// Writes a warning message.
/// </summary>
/// <param name="format">Format.</param>
/// <param name="arguments">Arguments.</param>
cin
improved log concept
r36 [Conditional("TRACE")]
public static void TraceWarning(string format, params object[] arguments) {
cin
working version of the project
r200 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceContext.Instance.CurrentOperation, TraceEventType.Warning, format, arguments));
cin
improved log concept
r36 }
[Conditional("TRACE")]
public static void TraceError(string format, params object[] arguments) {
cin
working version of the project
r200 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceContext.Instance.CurrentOperation, TraceEventType.Error, format, arguments));
cin
improved log concept
r36 }
[Conditional("TRACE")]
public static void TraceError(Exception err) {
TraceError("{0}", err);
}
}
}