Beispiel #1
0
        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);
                }
            };
        }
Beispiel #3
0
 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);
 }
Beispiel #4
0
 public void ApplicationError(string connectionId, string traceIdentifier, Exception ex)
 {
     _trace1.ApplicationError(connectionId, traceIdentifier, ex);
     _trace2.ApplicationError(connectionId, traceIdentifier, ex);
 }