Пример #1
0
        private void Enqueue(AsyncLogEventInfo asyncLogEventInfo, int timeout)
        {
            void LogEnqueueResult(string message)
            {
                if (!InternalLogger.IsDebugEnabled)
                {
                    return;
                }
                InternalLogger.Debug("[Syslog] {0} '{1}'", message, asyncLogEventInfo.ToFormattedMessage());
            }

            if (queue.TryAdd(asyncLogEventInfo, timeout, token))
            {
                LogEnqueueResult("Enqueued");
                return;
            }
            LogEnqueueResult("Failed enqueuing");
            asyncLogEventInfo.Continuation(new InvalidOperationException($"Enqueue failed"));
        }
Пример #2
0
 public override string ToString()
 {
     return(asyncLogEvent.ToFormattedMessage());
 }
Пример #3
0
 private void Enqueue(AsyncLogEventInfo asyncLogEventInfo, int timeout)
 {
     queue.TryAdd(asyncLogEventInfo, timeout, token);
     InternalLogger.Debug(() => $"Enqueued '{asyncLogEventInfo.ToFormattedMessage()}'");
 }
        private void Enqueue(AsyncLogEventInfo asyncLogEventInfo, int timeout)
        {
            bool enqueued = queue.TryAdd(asyncLogEventInfo, timeout, token);

            if (InternalLogger.IsDebugEnabled)
            {
                InternalLogger.Debug("[Syslog] {0} '{1}'", enqueued ? "Enqueued" : "Failed enqueuing", asyncLogEventInfo.ToFormattedMessage());
            }

            if (!enqueued)
            {
                asyncLogEventInfo.Continuation(new InvalidOperationException($"Failed enqueuing"));
            }
        }