Skip to content

Commit

Permalink
Adds experimental debouncer option
Browse files Browse the repository at this point in the history
  • Loading branch information
demelev committed Aug 12, 2023
1 parent 63e1f2f commit 59223c6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/Sentry.Unity/Integrations/UnityLogHandlerIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,21 @@ internal void CaptureLogFormat(LogType logType, UnityEngine.Object? context, str
return;
}

if (args[0] is not string logMessage)
{
return;
}

if (logType == LogType.Exception && args.Length < 2)
{
return;
}
// We're not capturing SDK internal logs
if (logMessage.StartsWith(UnityLogger.LogPrefix, StringComparison.Ordinal))
{
// TODO: Maybe color Sentry internal logs (highlight 'Sentry'?)
return;
}
// if (args[0] is not string logMessage)
// {
// return;
// }

// if (logType == LogType.Exception && args.Length < 2)
// {
// return;
// }
// // We're not capturing SDK internal logs
// if (logMessage.StartsWith(UnityLogger.LogTag, StringComparison.Ordinal))
// {
// // TODO: Maybe color Sentry internal logs (highlight 'Sentry'?)
// return;
// }

void Capture(string logMessage, LogType logType, bool OnlyBreadcrumbs = false)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Sentry.Unity/ScriptableSentryUnityOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static string GetConfigPath(string? notDefaultConfigName = null)
[field: SerializeField] public string? Dsn { get; set; }
[field: SerializeField] public bool CaptureInEditor { get; set; } = true;
[field: SerializeField] public bool TreatExceptionsAsHandled { get; set; } = false;
[field: SerializeField] public bool UseExperimentalDebouncer { get; set; } = false;
[field: SerializeField] public bool EnableLogDebouncing { get; set; } = false;
[field: SerializeField] public int DebounceTimeLog { get; set; } = (int)TimeSpan.FromSeconds(1).TotalMilliseconds;
[field: SerializeField] public int DebounceTimeWarning { get; set; } = (int)TimeSpan.FromSeconds(1).TotalMilliseconds;
Expand Down Expand Up @@ -133,6 +134,7 @@ internal SentryUnityOptions ToSentryUnityOptions(bool isBuilding, ISentryUnityIn
DebounceTimeLog = TimeSpan.FromMilliseconds(DebounceTimeLog),
DebounceTimeWarning = TimeSpan.FromMilliseconds(DebounceTimeWarning),
DebounceTimeError = TimeSpan.FromMilliseconds(DebounceTimeError),
UseExperimentalDebouncer = UseExperimentalDebouncer,
TreatExceptionsAsHandled = TreatExceptionsAsHandled,
TracesSampleRate = TracesSampleRate,
AutoStartupTraces = AutoStartupTraces,
Expand Down

0 comments on commit 59223c6

Please sign in to comment.