Add developer options for Rust's Trace Log Packs. (#3929)

* Add support for configuring log packs.

* Update call widget parameters.

* Update the SDK.
This commit is contained in:
Doug
2025-03-21 19:00:13 +00:00
committed by GitHub
parent 8ada12c668
commit a142ce43af
14 changed files with 122 additions and 18 deletions
@@ -69,7 +69,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
let appSettings = appHooks.appSettingsHook.configure(AppSettings())
Target.mainApp.configure(logLevel: appSettings.logLevel)
Target.mainApp.configure(logLevel: appSettings.logLevel, traceLogPacks: appSettings.traceLogPacks)
let appName = InfoPlistReader.main.bundleDisplayName
let appVersion = InfoPlistReader.main.bundleShortVersionString
@@ -11,6 +11,7 @@ import SwiftUI
// Common settings between app and NSE
protocol CommonSettingsProtocol {
var logLevel: LogLevel { get }
var traceLogPacks: Set<TraceLogPack> { get }
var enableOnlySignedDeviceIsolationMode: Bool { get }
var hideInviteAvatars: Bool { get }
var hideTimelineMedia: Bool { get }
@@ -36,6 +37,7 @@ final class AppSettings {
case enableInAppNotifications
case pusherProfileTag
case logLevel
case traceLogPacks
case viewSourceEnabled
case optimizeMediaUploads
case appAppearance
@@ -306,6 +308,9 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.logLevel, defaultValue: LogLevel.info, storageType: .userDefaults(store))
var logLevel
@UserPreference(key: UserDefaultsKeys.traceLogPacks, defaultValue: [], storageType: .userDefaults(store))
var traceLogPacks: Set<TraceLogPack>
/// Configuration to enable only signed device isolation mode for crypto. In this mode only devices signed by their owner will be considered in e2ee rooms.
@UserPreference(key: UserDefaultsKeys.enableOnlySignedDeviceIsolationMode, defaultValue: false, storageType: .userDefaults(store))
var enableOnlySignedDeviceIsolationMode
@@ -15,23 +15,35 @@ enum Target: String {
private static var isConfigured = false
func configure(logLevel: LogLevel) {
func configure(logLevel: LogLevel, traceLogPacks: Set<TraceLogPack>) {
guard !Self.isConfigured else {
return
}
switch self {
case .mainApp:
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel, currentTarget: rawValue, filePrefix: nil)
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
traceLogPacks: traceLogPacks,
currentTarget: rawValue,
filePrefix: nil)
initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: false)
case .nse:
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel, currentTarget: rawValue, filePrefix: rawValue)
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
traceLogPacks: traceLogPacks,
currentTarget: rawValue,
filePrefix: rawValue)
initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: true)
case .shareExtension:
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel, currentTarget: rawValue, filePrefix: rawValue)
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
traceLogPacks: traceLogPacks,
currentTarget: rawValue,
filePrefix: rawValue)
initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: true)
case .tests:
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel, currentTarget: rawValue, filePrefix: rawValue)
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
traceLogPacks: traceLogPacks,
currentTarget: rawValue,
filePrefix: rawValue)
initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: false)
}