mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
27 lines
940 B
Swift
27 lines
940 B
Swift
import Foundation
|
|
import Postbox
|
|
import SwiftSignalKit
|
|
import MtProtoKit
|
|
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
|
|
}
|
|
}
|
|
}
|