コード例 #1
0
ファイル: LogManager.cs プロジェクト: y-skindersky/ZeroLog
        private static void FormatErrorMessage(StringBuffer stringBuffer, IInternalLogEvent logEvent)
        {
            stringBuffer.Clear();
            stringBuffer.Append("An error occured during formatting: ");

            logEvent.WriteToStringBufferUnformatted(stringBuffer);
        }
コード例 #2
0
ファイル: LogManager.cs プロジェクト: scottstephens/ZeroLog
 private static void WriteMessageLogToAppenders(byte[] destination, IInternalLogEvent logEvent, int bytesWritten)
 {
     foreach (var appender in logEvent.Appenders)
     {
         // if (logEvent.Level >= Level) // TODO Check this ? log event should not be in queue if not > Level
         appender.WriteEvent(logEvent, destination, bytesWritten);
     }
 }
コード例 #3
0
ファイル: LogManager.cs プロジェクト: y-skindersky/ZeroLog
        private void WriteMessageLogToAppenders(byte[] destination, IInternalLogEvent logEvent, int bytesWritten)
        {
            var appenders = logEvent.Appenders;

            for (var i = 0; i < appenders.Count; i++)
            {
                var appender = appenders[i];
                // if (logEvent.Level >= Level) // TODO Check this ? log event should not be in queue if not > Level
                appender.WriteEvent(logEvent, destination, bytesWritten);
            }
        }
コード例 #4
0
ファイル: LogManager.cs プロジェクト: scottstephens/ZeroLog
        private static void HandleFormattingError(StringBuffer stringBuffer, IInternalLogEvent logEvent, byte[] destination, out int bytesWritten)
        {
            try
            {
                stringBuffer.Clear();
                stringBuffer.Append("An error occured during formatting: ");

                logEvent.WriteToStringBufferUnformatted(stringBuffer);
                bytesWritten = CopyStringBufferToByteArray(stringBuffer, destination);
            }
            catch (Exception ex)
            {
                stringBuffer.Clear();
                stringBuffer.Append("An error occured during formatting: ");
                stringBuffer.Append(ex.Message);
                bytesWritten = CopyStringBufferToByteArray(stringBuffer, destination);
            }
        }
コード例 #5
0
 internal void Enqueue(IInternalLogEvent logEvent)
 {
     _logManager.Enqueue(logEvent);
 }
コード例 #6
0
ファイル: LogManager.cs プロジェクト: scottstephens/ZeroLog
 private static void FormatLogMessage(StringBuffer stringBuffer, IInternalLogEvent logEvent)
 {
     stringBuffer.Clear();
     logEvent.WriteToStringBuffer(stringBuffer);
 }
コード例 #7
0
ファイル: LogManager.cs プロジェクト: scottstephens/ZeroLog
 void IInternalLogManager.Enqueue(IInternalLogEvent logEvent)
 => _queue.Enqueue(logEvent);
コード例 #8
0
 public void Enqueue(IInternalLogEvent logEvent)
 => throw new NotSupportedException();
コード例 #9
0
 public ForwardingLogEvent(IInternalLogEvent logEventToAppend)
 {
     _logEventToAppend = logEventToAppend;
 }
コード例 #10
0
 public ForwardingLogEvent(IInternalLogEvent logEventToAppend, Log log)
 {
     _logEventToAppend = logEventToAppend;
     _log = log;
 }
コード例 #11
0
 public ForwardingLogEvent([NotNull] IInternalLogEvent logEventToAppend, [NotNull] Log log)
 {
     _logEventToAppend = logEventToAppend;
     _log = log;
 }
コード例 #12
0
 public IInternalLogEvent AllocateLogEvent(LogEventPoolExhaustionStrategy logEventPoolExhaustionStrategy, IInternalLogEvent logEvent, Level level, Log log)
 => throw new NotSupportedException();
コード例 #13
0
ファイル: LogManager.cs プロジェクト: y-skindersky/ZeroLog
        IInternalLogEvent IInternalLogManager.AllocateLogEvent(LogEventPoolExhaustionStrategy logEventPoolExhaustionStrategy, IInternalLogEvent notifyPoolExhaustionLogEvent, Level level, Log log)
        {
            IInternalLogEvent Initialize(IInternalLogEvent l)
            {
                l.Initialize(level, log);
                return(l);
            }

            if (_pool.TryAcquire(out var logEvent))
            {
                return(Initialize(logEvent));
            }

            switch (logEventPoolExhaustionStrategy)
            {
            case LogEventPoolExhaustionStrategy.WaitForLogEvent:
                return(Initialize(AcquireLogEvent()));

            case LogEventPoolExhaustionStrategy.DropLogMessage:
                return(NoopLogEvent.Instance);

            default:
                return(notifyPoolExhaustionLogEvent);
            }
        }