Skip to content

Commit

Permalink
Fix VLog error suppression
Browse files Browse the repository at this point in the history
Summary: Skip errors instead of turning them into warnings.  Editor Only

Reviewed By: yolanother

Differential Revision: D42480607

fbshipit-source-id: 0b0f47962d499aa313d8985f91f0357313fc8c04
  • Loading branch information
Ryan Bailey authored and facebook-github-bot committed Jan 12, 2023
1 parent 000ac26 commit 5c0f420
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
18 changes: 8 additions & 10 deletions Lib/Wit/Runtime/Utilities/VLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public static LogType EditorLogLevel
private static LogType _editorLogLevel = (LogType)(-1);
private const string EDITOR_LOG_LEVEL_KEY = "VSDK_EDITOR_LOG_LEVEL";
private const LogType EDITOR_LOG_LEVEL_DEFAULT = LogType.Warning;
#endif

/// <summary>
/// Allows supression of all vlog errors
/// Hides all errors from the console
/// </summary>
public static bool SuppressErrors { get; set; } = false;
#endif

/// <summary>
/// Event for appending custom data to a log before logging to console
Expand Down Expand Up @@ -93,6 +93,11 @@ private static void Log(LogType logType, string logCategory, object log)
{
return;
}
// Suppress errors in editor
if (SuppressErrors)
{
return;
}
#endif

// Use calling category if null
Expand Down Expand Up @@ -138,14 +143,7 @@ private static void Log(LogType logType, string logCategory, object log)
switch (logType)
{
case LogType.Error:
if (SuppressErrors)
{
UnityEngine.Debug.LogWarning(result);
}
else
{
UnityEngine.Debug.LogError(result);
}
UnityEngine.Debug.LogError(result);
break;
case LogType.Warning:
UnityEngine.Debug.LogWarning(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ internal static void ImportData(this WitConfiguration configuration, Manifest ma
VLog.SuppressErrors = suppressErrors;
PerformRequest(request, (error) =>
{
VLog.SuppressErrors = false;
if (!string.IsNullOrEmpty(error))
{
onComplete?.Invoke(false, error);
Expand Down

0 comments on commit 5c0f420

Please sign in to comment.