using System.Diagnostics.CodeAnalysis;
namespace StardewModdingAPI.Web.Framework.LogParsing.Models
{
/// A parsed log message.
public class LogMessage
{
/*********
** Accessors
*********/
/// The local time when the log was posted.
public string Time { get; }
/// The log level.
public LogLevel Level { get; }
/// The screen ID in split-screen mode.
public int ScreenId { get; }
/// The mod name.
public string Mod { get; }
/// The log text.
public string Text { get; }
/// The number of times this message was repeated consecutively.
public int Repeated { get; set; }
/// The section that this log message belongs to.
public LogSection? Section { get; set; }
/// Whether this message is the first one of its section.
[MemberNotNullWhen(true, nameof(LogMessage.Section))]
public bool IsStartOfSection { get; set; }
/*********
** Public methods
*********/
/// Construct an instance/
/// The local time when the log was posted.
/// The log level.
/// The screen ID in split-screen mode.
/// The mod name.
/// The log text.
/// The number of times this message was repeated consecutively.
/// The section that this log message belongs to.
/// Whether this message is the first one of its section.
public LogMessage(string time, LogLevel level, int screenId, string mod, string text, int repeated = 0, LogSection? section = null, bool isStartOfSection = false)
{
this.Time = time;
this.Level = level;
this.ScreenId = screenId;
this.Mod = mod;
this.Text = text;
this.Repeated = repeated;
this.Section = section;
this.IsStartOfSection = isStartOfSection;
}
}
}