##// END OF EJS Templates
added Safe.DispatchEvent() a legacy equivalent for '?.Invoke()'...
added Safe.DispatchEvent() a legacy equivalent for '?.Invoke()' added Safe.Dispose(IEnumerable) added PromiseExtensions.CancellationPoint to add a cancellation point to the chain of promises added IPromise<T> PromiseExtensions.Then<T>(this IPromise<T> that, Action<T> success) overloads added PromiseExtensions.Error() overloads to handle a error or(and) a cancellation

File last commit:

r134:04d4c92d0f28 v2
r207:558f34b2fb50 v2
Show More
ConsoleTraceListener.cs
22 lines | 668 B | text/x-csharp | CSharpLexer
using System;
using System.Text;
namespace Implab.Diagnostics {
public class ConsoleTraceListener: ListenerBase {
static readonly object _consoleLock = new object();
public override void Write(LogEventArgs args, object entry) {
var msg = new StringBuilder();
for (int i = 0; i < args.Operation.Level; i++)
msg.Append(" ");
msg.AppendFormat("[{0}]: {1}", args.ThreadId, entry);
lock (_consoleLock) {
Console.ForegroundColor = (ConsoleColor)(args.ThreadId % 15 + 1);
Console.WriteLine(msg);
}
}
}
}