Skip to content

Commit

Permalink
- Adding debug logging for Goal and Persistent Timer Overlay Widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Olivo committed Oct 13, 2024
1 parent eba127c commit c5a2a5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions MixItUp.Base/Model/Overlay/OverlayGoalV3Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using MixItUp.Base.Services.Twitch;
using MixItUp.Base.Util;
using MixItUp.Base.ViewModel.User;
using StreamingClient.Base.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
Expand Down Expand Up @@ -283,6 +284,8 @@ public override async Task ProcessEvent(UserV2ViewModel user, double amount)
{
if (this.CurrentSegment != null)
{
Logger.Log(LogLevel.Debug, $"Processing goal amount - {amount}");

if (this.GoalType == OverlayGoalV3Type.Followers && user.Platform == this.StreamingPlatform)
{
amount = 1;
Expand Down Expand Up @@ -310,6 +313,8 @@ public override async Task ProcessEvent(UserV2ViewModel user, double amount)
previousAmount = this.CounterPreviousCurrentAmount;
}

Logger.Log(LogLevel.Debug, $"New amounts - {this.CurrentAmount} / {this.GoalAmount} ({this.TotalAmount})");

if (this.CurrentAmount >= this.GoalAmount && (this.CurrentSegment != this.Segments.Last() || previousAmount < this.GoalAmount))
{
IEnumerable<OverlayGoalSegmentV3Model> segmentsCompleted = this.ProgressSegments();
Expand Down
6 changes: 6 additions & 0 deletions MixItUp.Base/Model/Overlay/OverlayPersistentTimerV3Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Threading;
using System.Text.Json.Serialization;
using MixItUp.Base.Util;
using StreamingClient.Base.Util;

namespace MixItUp.Base.Model.Overlay
{
Expand Down Expand Up @@ -112,6 +113,9 @@ public override async Task ProcessEvent(UserV2ViewModel user, double amount)
if (!this.paused || this.AllowAdjustmentWhilePaused)
{
amount = Math.Round(amount);

Logger.Log(LogLevel.Debug, $"Processing timer amount - {amount}");

lock (amountLock)
{
if (this.MaxAmount > 0 && amount > 0)
Expand All @@ -128,6 +132,8 @@ public override async Task ProcessEvent(UserV2ViewModel user, double amount)
this.CurrentAmount = Math.Max(this.CurrentAmount, 1);
}

Logger.Log(LogLevel.Debug, $"New timer amount - {this.CurrentAmount}");

if (amount != 0)
{
Dictionary<string, object> properties = new Dictionary<string, object>();
Expand Down

0 comments on commit c5a2a5a

Please sign in to comment.