using System;
namespace BepInEx.Logging
{
///
/// Log event arguments. Contains info about the log message.
///
public class LogEventArgs : EventArgs
{
///
/// Logged data.
///
public object Data { get; protected set; }
///
/// Log levels for the data.
///
public LogLevel Level { get; protected set; }
///
/// Log source that emitted the log event.
///
public ILogSource Source { get; protected set; }
///
/// Creates the log event args-
///
/// Logged data.
/// Log level of the data.
/// Log source that emits these args.
public LogEventArgs(object data, LogLevel level, ILogSource source)
{
Data = data;
Level = level;
Source = source;
}
///
public override string ToString()
{
return $"[{Level,-7}:{Source.SourceName,10}] {Data}";
}
///
/// Like but appends newline at the end.
///
/// Same output as but with new line.
public string ToStringLine()
{
return $"[{Level,-7}:{Source.SourceName,10}] {Data}{Environment.NewLine}";
}
}
}