public LoggingThreadPool(IKestrelTrace log) { _log = log; // Curry and capture log in closures once _runAction = (o) => { try { ((Action)o)(); } catch (Exception e) { _log.ApplicationError(e); } }; _completeTcs = (o) => { try { ((TaskCompletionSource <object>)o).TrySetResult(null); } catch (Exception e) { _log.ApplicationError(e); } }; }
public LoggingThreadPool(IKestrelTrace log) { _log = log; // Curry and capture log in closures once _runAction = (o) => { try { ((Action)o)(); } catch (Exception e) { _log.ApplicationError(e); } }; _completeTcs = (o) => { try { ((TaskCompletionSource<object>)o).TrySetResult(null); } catch (Exception e) { _log.ApplicationError(e); } }; }
public void Error(TaskCompletionSource <object> tcs, Exception ex) { // ex ang _log are closure captured ThreadPool.QueueUserWorkItem((o) => { try { ((TaskCompletionSource <object>)o).TrySetException(ex); } catch (Exception e) { _log.ApplicationError(e); } }, tcs); }
public void ApplicationError(string connectionId, string traceIdentifier, Exception ex) { _trace1.ApplicationError(connectionId, traceIdentifier, ex); _trace2.ApplicationError(connectionId, traceIdentifier, ex); }