Use the custom log level inside the NSE too. (#2020)

This commit is contained in:
Doug
2023-11-04 08:36:49 +00:00
committed by GitHub
parent f4d164b2e7
commit 19947b7177
5 changed files with 9 additions and 4 deletions

View File

@@ -15,5 +15,5 @@
//
enum SharedUserDefaultsKeys: String {
case filterNotificationsByPushRulesEnabled
case logLevel
}

View File

@@ -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)

View File

@@ -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) {

View File

@@ -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
}

View File

@@ -0,0 +1 @@
Use the custom log level inside the NSE too.