-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugLogging.cs
More file actions
28 lines (25 loc) · 853 Bytes
/
DebugLogging.cs
File metadata and controls
28 lines (25 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Diagnostics;
namespace LiveSplit.TwitchPredictions
{
public static class DebugLogging
{
public delegate void InvokeLogDelegade(string text, bool dontPostInChat);
public static TwitchPredictionsSettings _settings;
public static void Log(string text, bool dontPostInChat = false)
{
if (_settings.RB_DebugView.InvokeRequired)
{
_settings.RB_DebugView.Invoke(new InvokeLogDelegade(Log), text, dontPostInChat);
}
else
{
string textToPost = DateTime.Now.ToShortTimeString() + ": " + text;
Debug.WriteLine("[PredictionsPlugin] " + textToPost);
_settings.RB_DebugView.AppendText(textToPost + "\n");
if ((_settings.SplitsToEventsInstance?.NotifyOfErrorsInChat ?? false) && !dontPostInChat)
TwitchConnection.GetInstance().WriteInChat("[Prediction Plugin] " + text);
}
}
}
}