diff --git a/LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj b/LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj
index 2f9178b..4c55555 100644
--- a/LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj
+++ b/LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj
@@ -41,6 +41,9 @@
..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
+
+ ..\packages\Microsoft.Extensions.Logging.Abstractions.7.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll
+
..\packages\PlayniteSDK.6.10.0\lib\net462\Playnite.SDK.dll
@@ -104,6 +107,7 @@
+
diff --git a/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs b/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs
index 5c12d2c..99206df 100644
--- a/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs
+++ b/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs
@@ -39,7 +39,7 @@ namespace LANCommander.PlaynitePlugin
Settings = new LANCommanderSettingsViewModel(this);
- LANCommanderClient = new SDK.Client(Settings.ServerAddress);
+ LANCommanderClient = new SDK.Client(Settings.ServerAddress, new PlayniteLogger(Logger));
LANCommanderClient.UseToken(new SDK.Models.AuthToken()
{
AccessToken = Settings.AccessToken,
diff --git a/LANCommander.Playnite.Extension/PlayniteLogger.cs b/LANCommander.Playnite.Extension/PlayniteLogger.cs
new file mode 100644
index 0000000..a570720
--- /dev/null
+++ b/LANCommander.Playnite.Extension/PlayniteLogger.cs
@@ -0,0 +1,55 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LANCommander.PlaynitePlugin
+{
+ public sealed class PlayniteLogger : ILogger
+ {
+ private readonly Playnite.SDK.ILogger Logger;
+
+ public PlayniteLogger(Playnite.SDK.ILogger logger) {
+ Logger = logger;
+ }
+
+ public IDisposable BeginScope(TState state)
+ {
+ return default;
+ }
+
+ public bool IsEnabled(LogLevel logLevel)
+ {
+ return true;
+ }
+
+ public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter)
+ {
+ switch (logLevel)
+ {
+ case LogLevel.Trace:
+ Logger?.Trace(formatter.Invoke(state, exception));
+ break;
+
+ case LogLevel.Debug:
+ Logger?.Debug(formatter.Invoke(state, exception));
+ break;
+
+ case LogLevel.Information:
+ Logger.Info(formatter.Invoke(state, exception));
+ break;
+
+ case LogLevel.Warning:
+ Logger.Warn(formatter.Invoke(state, exception));
+ break;
+
+ case LogLevel.Error:
+ case LogLevel.Critical:
+ Logger.Error(formatter.Invoke(state, exception));
+ break;
+ }
+ }
+ }
+}