using System;
namespace Microsoft.Extensions.Logging.Log4Net.AspNetCore.Entities
{
///
/// Represents a candidate for a log message that should be printed. This candidate will either be accepted or denied by the logger that is trying to print it.
///
///
///
/// This is a readonly struct to reduce memory pressure, but because it is quite large (definitly larger than the recommended 16 bytes)
/// it needs to be passed as a reference (with the in keyword) to make a difference.
///
///
/// See for more information.
///
///
/// Type of the state that is used to format the error message.
public readonly struct MessageCandidate
{
public MessageCandidate(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter)
{
State = state;
LogLevel = logLevel;
EventId = eventId;
Exception = exception;
Formatter = formatter;
}
///
/// The log level the message should be printed with.
///
public LogLevel LogLevel { get; }
///
/// The event id of the message.
///
public EventId EventId { get; }
///
/// The message state. Can be provided to the formatter to generate the string representation of the error message.
///
public TState State { get; }
///
/// Exception that should be printed with the message. Null if the log message has no corrosponding exception.
///
public Exception Exception { get; }
///
/// The message formatter. Can be called with the state and exception to generate the string representation of the error message.
///
public Func Formatter { get; }
}
}