diff --git a/ElementX/Sources/Other/SharedUserDefaultsKeys.swift b/ElementX/Sources/Other/SharedUserDefaultsKeys.swift index a941785b4a..93c3614cf7 100644 --- a/ElementX/Sources/Other/SharedUserDefaultsKeys.swift +++ b/ElementX/Sources/Other/SharedUserDefaultsKeys.swift @@ -15,5 +15,5 @@ // enum SharedUserDefaultsKeys: String { - case filterNotificationsByPushRulesEnabled + case logLevel } diff --git a/NSE/Sources/NotificationServiceExtension.swift b/NSE/Sources/NotificationServiceExtension.swift index 92ef306fe4..0c7139f491 100644 --- a/NSE/Sources/NotificationServiceExtension.swift +++ b/NSE/Sources/NotificationServiceExtension.swift @@ -69,7 +69,7 @@ class NotificationServiceExtension: UNNotificationServiceExtension { handler = contentHandler modifiedContent = request.content.mutableCopy() as? UNMutableNotificationContent - NSELogger.configure() + NSELogger.configure(logLevel: settings.logLevel) NSELogger.logMemory(with: tag) diff --git a/NSE/Sources/Other/NSELogger.swift b/NSE/Sources/Other/NSELogger.swift index d51f263d5c..4abb97c730 100644 --- a/NSE/Sources/Other/NSELogger.swift +++ b/NSE/Sources/Other/NSELogger.swift @@ -75,13 +75,13 @@ class NSELogger { return "\(formattedStr) MB" } - static func configure() { + static func configure(logLevel: TracingConfiguration.LogLevel) { guard !isConfigured else { return } isConfigured = true - MXLog.configure(target: "nse", logLevel: .info) + MXLog.configure(target: "nse", logLevel: logLevel) } static func logMemory(with tag: String) { diff --git a/NSE/Sources/Other/NSESettings.swift b/NSE/Sources/Other/NSESettings.swift index d0dd2cbb82..486c4ff4b0 100644 --- a/NSE/Sources/Other/NSESettings.swift +++ b/NSE/Sources/Other/NSESettings.swift @@ -21,4 +21,8 @@ final class NSESettings { /// UserDefaults to be used on reads and writes. private static var store: UserDefaults! = UserDefaults(suiteName: suiteName) + + /// The log level that should be used by `MXLog`. + @UserPreference(key: SharedUserDefaultsKeys.logLevel, defaultValue: TracingConfiguration.LogLevel.info, storageType: .userDefaults(store)) + var logLevel } diff --git a/changelog.d/pr-2020.bugfix b/changelog.d/pr-2020.bugfix new file mode 100644 index 0000000000..8b383e467a --- /dev/null +++ b/changelog.d/pr-2020.bugfix @@ -0,0 +1 @@ +Use the custom log level inside the NSE too. \ No newline at end of file