Mercurial > pub > ImplabNet
view Implab/Diagnostics/Extensions.cs @ 127:d86da8d2d4c3 v2
fixed AsyncQueue iterator
author | cin |
---|---|
date | Tue, 27 Jan 2015 18:18:29 +0300 |
parents | 2573b562e328 |
children | 04d4c92d0f28 |
line wrap: on
line source
using System; 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); } } }