Mercurial > pub > ImplabNet
view Implab/Diagnostics/Extensions.cs @ 137:238e15580926 v2
added the blocking queue
author | cin |
---|---|
date | Mon, 16 Feb 2015 17:48:39 +0300 |
parents | 04d4c92d0f28 |
children | f75cfa58e3d4 |
line wrap: on
line source
namespace Implab.Diagnostics { public static class Extensions { public static IPromise<T> EndLogicalOperation<T>(this IPromise<T> promise) { Safe.ArgumentNotNull(promise, "promise"); var op = TraceContext.Instance.DetachLogicalOperation(); return promise.On( x => { TraceContext.Instance.EnterLogicalOperation(op,true); TraceLog.TraceInformation("promise = {0}", x); TraceLog.EndLogicalOperation(); TraceContext.Instance.Leave(); }, err =>{ TraceContext.Instance.EnterLogicalOperation(op,true); TraceLog.TraceError("promise died {0}", err); TraceLog.EndLogicalOperation(); TraceContext.Instance.Leave(); }, () => { TraceContext.Instance.EnterLogicalOperation(op,true); TraceLog.TraceInformation("promise cancelled"); TraceLog.EndLogicalOperation(); TraceContext.Instance.Leave(); } ); } public static IPromise EndLogicalOperation(this IPromise promise) { Safe.ArgumentNotNull(promise, "promise"); var op = TraceContext.Instance.DetachLogicalOperation(); return promise.On(() => { TraceContext.Instance.EnterLogicalOperation(op,true); TraceLog.EndLogicalOperation(); TraceContext.Instance.Leave(); }, PromiseEventType.All); } } }