public virtual void fireExitRule(int ruleNum, int guessing, int data) { TraceEventHandler eventDelegate = (TraceEventHandler)((CharScanner)source).Events[Parser.ExitRuleEventKey]; if (eventDelegate != null) { traceEvent.setValues(TraceEventArgs.EXIT, ruleNum, guessing, data); eventDelegate(source, traceEvent); } checkController(); ruleDepth--; if (ruleDepth == 0) { fireDoneParsing(); } }
/// <summary> /// Traces the specified scope request. /// </summary> /// <param name="scope">The scope.</param> /// <param name="context">The context.</param> /// <param name="eventHandler">The event handler.</param> /// <returns></returns> public static ILifetimeScope Trace(this ILifetimeScope scope, HttpContext context, TraceEventHandler eventHandler) { var settings = scope.Resolver.Resolve <ISimplifyWebSettings>(); if (settings.ConsoleTracing) { TraceToConsole(context); } eventHandler?.Invoke(context); return(scope); }
/// <summary> 移除代码追踪事件侦听 </summary> /// <param name="listener">代码追踪事件侦听函数 ( Params - 代码追踪数据 ) </param> public void RemoveTraceListener(Action <TraceData> listener) => TraceEventHandler.RemoveListener(listener);
private static void Trace(object @this, Stream stream, byte[] buffer, int offset, int count, TraceEventHandler handler, bool isWrite) { if (handler != null) { handler(@this, new TraceEventArgs(stream, buffer, offset, count, isWrite)); } }
/// <summary> 添加代码追踪事件侦听 </summary> /// <param name="listener">代码追踪事件侦听函数 ( Params - 代码追踪数据 ) </param> /// <param name="priority">设置侦听函数执行优先级,数值越高优先级越高。同数值情况下,先添加的侦听函数优先级更高,默认为 0 </param> public void AddTraceListener(Action <TraceData> listener, int priority = 0) => TraceEventHandler.AddListener(listener, priority);