コード例 #1
0
        public void Log <TState>(string categoryName, LogLevel logLevel, EventId eventId, TState state, Exception?exception, Func <TState, Exception?, string> formatter)
        {
            var record = new LogRecord(DateTime.Now, logLevel, eventId, state !, exception, (o, e) => formatter((TState)o, e), categoryName);

            _logs.Enqueue(record);

            RecordLogged?.Invoke(record);
        }
コード例 #2
0
        public void Log <TState>(string categoryName, LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            var record = new LogRecord
            {
                Timestamp  = DateTime.Now,
                LoggerName = categoryName,
                LogLevel   = logLevel,
                EventId    = eventId,
                State      = state,
                Exception  = exception,
                Formatter  = (o, e) => formatter((TState)o, e),
            };

            _logs.Enqueue(record);

            RecordLogged?.Invoke(record);
        }
コード例 #3
0
ファイル: TestLoggerSink.cs プロジェクト: zoroz/npgsql
 internal void AddLogRecord(LogRecord record)
 {
     Records.Add(record);
     RecordLogged?.Invoke(record);
 }