mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
34 lines
1.0 KiB
Swift
34 lines
1.0 KiB
Swift
import Foundation
|
|
#if os(macOS)
|
|
import PostboxMac
|
|
import SwiftSignalKitMac
|
|
import MtProtoKitMac
|
|
#else
|
|
import Postbox
|
|
import SwiftSignalKit
|
|
import MtProtoKit
|
|
#endif
|
|
|
|
import SyncCore
|
|
|
|
public func updateLoggingSettings(accountManager: AccountManager, _ f: @escaping (LoggingSettings) -> LoggingSettings) -> Signal<Void, NoError> {
|
|
return accountManager.transaction { transaction -> Void in
|
|
var updated: LoggingSettings?
|
|
transaction.updateSharedData(SharedDataKeys.loggingSettings, { current in
|
|
if let current = current as? LoggingSettings {
|
|
updated = f(current)
|
|
return updated
|
|
} else {
|
|
updated = f(LoggingSettings.defaultSettings)
|
|
return updated
|
|
}
|
|
})
|
|
|
|
if let updated = updated {
|
|
Logger.shared.logToFile = updated.logToFile
|
|
Logger.shared.logToConsole = updated.logToConsole
|
|
Logger.shared.redactSensitiveData = updated.redactSensitiveData
|
|
}
|
|
}
|
|
}
|