Skip to content

Commit

Permalink
ignoring some errors (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
amazingalek authored Jul 26, 2020
1 parent 172afaa commit fe244c3
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions OWML.ModHelper/Logging/ModSocketOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,27 @@ public ModSocketOutput(IOwmlConfig config, IModLogger logger, IModManifest manif

private void OnLogMessageReceived(string message, string stackTrace, LogType type)
{
if (type == LogType.Error || type == LogType.Exception)
if (type != LogType.Error && type != LogType.Exception || IsIgnored(message))
{
var socketMessage = new SocketMessage
{
SenderName = "Unity",
SenderType = type.ToString(),
Type = MessageType.Error,
Message = $"Unity log message: {message}. Stack trace: {stackTrace?.Trim()}"
};
WriteToSocket(JsonConvert.SerializeObject(socketMessage));
return;
}
var socketMessage = new SocketMessage
{
SenderName = "Unity",
SenderType = type.ToString(),
Type = MessageType.Error,
Message = $"Unity log message: {message}. Stack trace: {stackTrace?.Trim()}"
};
WriteToSocket(JsonConvert.SerializeObject(socketMessage));
}

private bool IsIgnored(string message)
{
return new[]
{
"requires a value from JoystickButton0 to JoystickButton19",
"MISSING TEXTURE"
}.Contains(message);
}

[Obsolete("Use WriteLine(string) or WriteLine(string, MessageType) instead.")]
Expand Down

0 comments on commit fe244c3

Please sign in to comment.