summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Views/LogParser
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-06-27 09:37:20 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-06-27 09:37:20 -0400
commitcf3728562771b20b66c3f9307a72ae3b19b10bdf (patch)
tree9dd0b466e132ad3040aba6454b28a5f903f94fbd /src/SMAPI.Web/Views/LogParser
parent9f7b4e029668ccb7b05fb8b5b02b7a3998b05a80 (diff)
downloadSMAPI-cf3728562771b20b66c3f9307a72ae3b19b10bdf.tar.gz
SMAPI-cf3728562771b20b66c3f9307a72ae3b19b10bdf.tar.bz2
SMAPI-cf3728562771b20b66c3f9307a72ae3b19b10bdf.zip
tweak log parser logic to handle new levels automatically
Diffstat (limited to 'src/SMAPI.Web/Views/LogParser')
-rw-r--r--src/SMAPI.Web/Views/LogParser/Index.cshtml16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
index 4d95901e..8151c502 100644
--- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
+++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
@@ -5,6 +5,11 @@
@{
ViewData["Title"] = "SMAPI log parser";
IDictionary<string, LogModInfo[]> contentPacks = Model.GetContentPacksByMod();
+ IDictionary<string, bool> defaultFilters = Enum
+ .GetValues(typeof(LogLevel))
+ .Cast<LogLevel>()
+ .ToDictionary(level => level.ToString().ToLower(), level => level != LogLevel.Trace);
+ JsonSerializerSettings noFormatting = new JsonSerializerSettings { Formatting = Formatting.None };
}
@section Head {
@@ -21,15 +26,8 @@
smapi.logParser({
logStarted: new Date(@Json.Serialize(Model.ParsedLog?.Timestamp)),
showPopup: @Json.Serialize(Model.ParsedLog == null),
- showMods: @Json.Serialize(Model.ParsedLog?.Mods?.Select(p => Model.GetSlug(p.Name)).Distinct().ToDictionary(slug => slug, slug => true), new JsonSerializerSettings { Formatting = Formatting.None }),
- showLevels: {
- @LogLevel.Trace.ToString().ToLower(): false,
- @LogLevel.Debug.ToString().ToLower(): true,
- @LogLevel.Info.ToString().ToLower(): true,
- @LogLevel.Alert.ToString().ToLower(): true,
- @LogLevel.Warn.ToString().ToLower(): true,
- @LogLevel.Error.ToString().ToLower(): true
- }
+ showMods: @Json.Serialize(Model.ParsedLog?.Mods?.Select(p => Model.GetSlug(p.Name)).Distinct().ToDictionary(slug => slug, slug => true), noFormatting),
+ showLevels: @Json.Serialize(defaultFilters, noFormatting)
}, '@Model.SectionUrl');
});
</script>