Ejemplo n.º 1
0
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            if (!IsEnabled(logLevel))
            {
                return;
            }

            if (formatter == null)
            {
                throw new ArgumentNullException(nameof(formatter));
            }

            string message = formatter(state, exception);

            if (!string.IsNullOrEmpty(message) || exception != null)
            {
                if (ParentLogger != null)
                {
                    ParentLogger.WriteMessage(Name, logLevel, eventId.Id, message, exception);
                }
                else
                {
                    WriteMessage(Name, logLevel, eventId.Id, message, exception);
                }
            }
        }
Ejemplo n.º 2
0
 public virtual void WriteMessage(string message)
 {
     ParentLogger.WriteMessage(message);
 }