diff --git a/Tranga/NotificationManager.cs b/Tranga/NotificationManager.cs index 65ad36d..1c6da52 100644 --- a/Tranga/NotificationManager.cs +++ b/Tranga/NotificationManager.cs @@ -7,7 +7,7 @@ namespace Tranga; public abstract class NotificationManager { - protected readonly Logger? logger; + protected Logger? logger; public NotificationManagerType notificationManagerType; protected NotificationManager(NotificationManagerType notificationManagerType, Logger? logger = null) @@ -19,6 +19,11 @@ public abstract class NotificationManager public enum NotificationManagerType : byte { Gotify = 0, LunaSea = 1 } public abstract void SendNotification(string title, string notificationText); + + public void AddLogger(Logger pLogger) + { + this.logger = pLogger; + } public class NotificationManagerJsonConverter : JsonConverter { diff --git a/Tranga/TrangaSettings.cs b/Tranga/TrangaSettings.cs index e26218c..086dad5 100644 --- a/Tranga/TrangaSettings.cs +++ b/Tranga/TrangaSettings.cs @@ -37,8 +37,12 @@ public class TrangaSettings TrangaSettings settings = JsonConvert.DeserializeObject(toRead, new JsonSerializerSettings { Converters = { new NotificationManager.NotificationManagerJsonConverter(), new LibraryManager.LibraryManagerJsonConverter() } })!; if (logger is not null) + { foreach (LibraryManager lm in settings.libraryManagers) lm.AddLogger(logger); + foreach(NotificationManager nm in settings.notificationManagers) + nm.AddLogger(logger); + } return settings; }