示例#1
0
        /// <inheritdoc />
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            if (formatter == null)
            {
                throw new ArgumentNullException(nameof(formatter));
            }
            var messageTemplate = formatter(state, exception);

            if (string.IsNullOrWhiteSpace(messageTemplate))
            {
                return;
            }
            _logger.Write(eventId.ToEventId(), LogLevelSwitcher.Switch(logLevel), exception, messageTemplate,
                          LogEventSendMode.Customize, NullLogCallerInfo.Instance);
        }