Skip to content

Commit 2661059

Browse files
committed
Fix RPC spamming warnings and errors
1 parent aec7b68 commit 2661059

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Discord/EliteAPI.Discord/EliteDangerousApiDiscordRichPresence.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class EliteDangerousApiDiscordRichPresence
1515
{
1616
private readonly ILogger<EliteDangerousApiDiscordRichPresence> _log;
1717
private readonly IEliteDangerousApi _api;
18-
private readonly DiscordRpcClient _client;
18+
private DiscordRpcClient _client;
1919

2020
private string _currentSystem = "";
2121
private string _currentBody = "";
@@ -25,13 +25,15 @@ public EliteDangerousApiDiscordRichPresence(ILogger<EliteDangerousApiDiscordRich
2525
{
2626
_log = log;
2727
_api = api;
28-
_client = new DiscordRpcClient("497862888128512041");
29-
_client.Logger = new ExtensionLogger(_log);
3028
}
3129

3230
public async Task StartAsync()
3331
{
3432
_log.LogDebug("Starting Discord Rich Presence...");
33+
34+
_client = new DiscordRpcClient("497862888128512041");
35+
_client.Logger = new ExtensionLogger(_log);
36+
3537
_client.Initialize();
3638

3739
_api.Events.On<FileheaderEvent>(OnFileheader);
@@ -481,12 +483,12 @@ public void Info(string message, params object[] args)
481483

482484
public void Warning(string message, params object[] args)
483485
{
484-
_log.LogWarning(message, args);
486+
_log.LogDebug(message, args);
485487
}
486488

487489
public void Error(string message, params object[] args)
488490
{
489-
_log.LogError(message, args);
491+
_log.LogDebug(message, args);
490492
}
491493

492494
public DiscordRPC.Logging.LogLevel Level { get; set; }

0 commit comments

Comments
 (0)