update game log filters (#638)

This commit is contained in:
Jesse Plamondon-Willard 2019-11-08 22:48:49 -05:00
parent a03137372d
commit 39214fd23f
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
1 changed files with 10 additions and 3 deletions

View File

@ -86,15 +86,20 @@ namespace StardewModdingAPI.Framework
/// <summary>Whether the program has been disposed.</summary>
private bool IsDisposed;
/// <summary>Regex patterns which match console messages to suppress from the console and log.</summary>
/// <summary>Regex patterns which match console non-error messages to suppress from the console and log.</summary>
private readonly Regex[] SuppressConsolePatterns =
{
new Regex(@"^TextBox\.Selected is now '(?:True|False)'\.$", RegexOptions.Compiled | RegexOptions.CultureInvariant),
new Regex(@"^(?:FRUIT )?TREE: IsClient:(?:True|False) randomOutput: \d+$", RegexOptions.Compiled | RegexOptions.CultureInvariant),
new Regex(@"^loadPreferences\(\); begin", RegexOptions.Compiled | RegexOptions.CultureInvariant),
new Regex(@"^savePreferences\(\); async=", RegexOptions.Compiled | RegexOptions.CultureInvariant),
new Regex(@"^DebugOutput:\s+(?:added CLOUD|added cricket|dismount tile|Ping|playerPos)", RegexOptions.Compiled | RegexOptions.CultureInvariant),
new Regex(@"^static SerializableDictionary<.+>\(\) called\.$", RegexOptions.Compiled | RegexOptions.CultureInvariant),
new Regex(@"^DebugOutput:\s+(?:added CLOUD|added cricket|dismount tile|Ping|playerPos)", RegexOptions.Compiled | RegexOptions.CultureInvariant)
};
/// <summary>Regex patterns which match console error messages to suppress from the console and log.</summary>
private readonly Regex[] SuppressConsoleErrorPatterns =
{
new Regex(@"^Error loading schedule data for (?:Bouncer|Dwarf|Gunther|Krobus|Marlon|Mister Qi|Sandy|Wizard): .+ ---> System\.IO\.FileNotFoundException", RegexOptions.Compiled | RegexOptions.CultureInvariant)
};
/// <summary>Regex patterns which match console messages to show a more friendly error for.</summary>
@ -1347,6 +1352,8 @@ namespace StardewModdingAPI.Framework
// ignore suppressed message
if (level != LogLevel.Error && this.SuppressConsolePatterns.Any(p => p.IsMatch(message)))
return;
if (level == LogLevel.Error && this.SuppressConsoleErrorPatterns.Any(p => p.IsMatch(message)))
return;
// show friendly error if applicable
foreach (var entry in this.ReplaceConsolePatterns)