RaspberryIO_26/Swan.Tiny/Logging/LogMessageReceivedEventArgs.cs
2019-12-10 20:20:45 +01:00

140 lines
3.8 KiB
C#

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