using System;
namespace Swan
{
///
/// Event arguments representing the message that is logged
/// on to the terminal. Use the properties to forward the data to
/// your logger of choice.
///
///
public class LogMessageReceivedEventArgs : EventArgs
{
///
/// Initializes a new instance of the class.
///
/// The sequence.
/// Type of the message.
/// The UTC date.
/// The source.
/// The message.
/// The extended data.
/// Name of the caller member.
/// The caller file path.
/// The caller line number.
public LogMessageReceivedEventArgs(
ulong sequence,
LogLevel messageType,
DateTime utcDate,
string source,
string message,
object? extendedData,
string callerMemberName,
string callerFilePath,
int callerLineNumber)
{
Sequence = sequence;
MessageType = messageType;
UtcDate = utcDate;
Source = source;
Message = message;
CallerMemberName = callerMemberName;
CallerFilePath = callerFilePath;
CallerLineNumber = callerLineNumber;
ExtendedData = extendedData;
}
///
/// Gets logging message sequence.
///
///
/// The sequence.
///
public ulong Sequence { get; }
///
/// Gets the type of the message.
/// It can be a combination as the enumeration is a set of bitwise flags.
///
///
/// The type of the message.
///
public LogLevel MessageType { get; }
///
/// Gets the UTC date at which the event at which the message was logged.
///
///
/// The UTC date.
///
public DateTime UtcDate { get; }
///
/// Gets the name of the source where the logging message
/// came from. This can come empty if the logger did not set it.
///
///
/// The source.
///
public string Source { get; }
///
/// Gets the body of the message.
///
///
/// The message.
///
public string Message { get; }
///
/// Gets the name of the caller member.
///
///
/// The name of the caller member.
///
public string CallerMemberName { get; }
///
/// Gets the caller file path.
///
///
/// The caller file path.
///
public string CallerFilePath { get; }
///
/// Gets the caller line number.
///
///
/// The caller line number.
///
public int CallerLineNumber { get; }
///
/// Gets an object representing extended data.
/// It could be an exception or anything else.
///
///
/// The extended data.
///
public object? ExtendedData { get; }
///
/// Gets the Extended Data properties cast as an Exception (if possible)
/// Otherwise, it return null.
///
///
/// The exception.
///
public Exception? Exception => ExtendedData as Exception;
}
}