diff options
Diffstat (limited to 'src/SMAPI.Web/Framework/LogParsing/Models')
4 files changed, 122 insertions, 0 deletions
diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogLevel.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogLevel.cs new file mode 100644 index 00000000..40d21bf8 --- /dev/null +++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogLevel.cs @@ -0,0 +1,24 @@ +namespace StardewModdingAPI.Web.Framework.LogParsing.Models +{ + /// <summary>The log severity levels.</summary> + public enum LogLevel + { + /// <summary>Tracing info intended for developers.</summary> + Trace, + + /// <summary>Troubleshooting info that may be relevant to the player.</summary> + Debug, + + /// <summary>Info relevant to the player. This should be used judiciously.</summary> + Info, + + /// <summary>An issue the player should be aware of. This should be used rarely.</summary> + Warn, + + /// <summary>A message indicating something went wrong.</summary> + Error, + + /// <summary>Important information to highlight for the player when player action is needed (e.g. new version available). This should be used rarely to avoid alert fatigue.</summary> + Alert + } +} diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs new file mode 100644 index 00000000..baeac83c --- /dev/null +++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs @@ -0,0 +1,24 @@ +namespace StardewModdingAPI.Web.Framework.LogParsing.Models +{ + /// <summary>A parsed log message.</summary> + public class LogMessage + { + /********* + ** Accessors + *********/ + /// <summary>The local time when the log was posted.</summary> + public string Time { get; set; } + + /// <summary>The log level.</summary> + public LogLevel Level { get; set; } + + /// <summary>The mod name.</summary> + public string Mod { get; set; } + + /// <summary>The log text.</summary> + public string Text { get; set; } + + /// <summary>The number of times this message was repeated consecutively.</summary> + public int Repeated { get; set; } + } +} diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/ModInfo.cs b/src/SMAPI.Web/Framework/LogParsing/Models/ModInfo.cs new file mode 100644 index 00000000..8c84ab38 --- /dev/null +++ b/src/SMAPI.Web/Framework/LogParsing/Models/ModInfo.cs @@ -0,0 +1,27 @@ +namespace StardewModdingAPI.Web.Framework.LogParsing.Models +{ + /// <summary>Metadata about a mod or content pack in the log.</summary> + public class LogModInfo + { + /********* + ** Accessors + *********/ + /// <summary>The mod name.</summary> + public string Name { get; set; } + + /// <summary>The mod author.</summary> + public string Author { get; set; } + + /// <summary>The mod version.</summary> + public string Version { get; set; } + + /// <summary>The mod description.</summary> + public string Description { get; set; } + + /// <summary>The name of the mod for which this is a content pack (if applicable).</summary> + public string ContentPackFor { get; set; } + + /// <summary>The number of errors logged by this mod.</summary> + public int Errors { get; set; } + } +} diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs b/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs new file mode 100644 index 00000000..31ef2fe1 --- /dev/null +++ b/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs @@ -0,0 +1,47 @@ +using System; + +namespace StardewModdingAPI.Web.Framework.LogParsing.Models +{ + /// <summary>Parsed metadata for a log.</summary> + public class ParsedLog + { + /********* + ** Accessors + *********/ + /**** + ** Metadata + ****/ + /// <summary>Whether the log file was successfully parsed.</summary> + public bool IsValid { get; set; } + + /// <summary>An error message indicating why the log file is invalid.</summary> + public string Error { get; set; } + + /// <summary>The raw text if <see cref="IsValid"/> is false.</summary> + public string RawTextIfError { get; set; } + + /**** + ** Log data + ****/ + /// <summary>The SMAPI version.</summary> + public string ApiVersion { get; set; } + + /// <summary>The game version.</summary> + public string GameVersion { get; set; } + + /// <summary>The player's operating system.</summary> + public string OperatingSystem { get; set; } + + /// <summary>The mod folder path.</summary> + public string ModPath { get; set; } + + /// <summary>The ISO 8601 timestamp when the log was started.</summary> + public DateTimeOffset Timestamp { get; set; } + + /// <summary>Metadata about installed mods and content packs.</summary> + public LogModInfo[] Mods { get; set; } = new LogModInfo[0]; + + /// <summary>The log messages.</summary> + public LogMessage[] Messages { get; set; } + } +} |