mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
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:
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Copyright 2025 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
enum TraceLogPack: Codable, CaseIterable {
|
||||
case eventCache, sendQueue, timeline
|
||||
|
||||
var title: String {
|
||||
switch self {
|
||||
case .eventCache:
|
||||
return "Event cache"
|
||||
case .sendQueue:
|
||||
return "Send queue"
|
||||
case .timeline:
|
||||
return "Timeline"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension TraceLogPack {
|
||||
// periphery:ignore - Unused, but added to detect new cases when updating the SDK.
|
||||
init(rustLogPack: MatrixRustSDK.TraceLogPacks) {
|
||||
switch rustLogPack {
|
||||
case .eventCache:
|
||||
self = .eventCache
|
||||
case .sendQueue:
|
||||
self = .sendQueue
|
||||
case .timeline:
|
||||
self = .timeline
|
||||
}
|
||||
}
|
||||
|
||||
var rustLogPack: MatrixRustSDK.TraceLogPacks {
|
||||
switch self {
|
||||
case .eventCache:
|
||||
return .eventCache
|
||||
case .sendQueue:
|
||||
return .sendQueue
|
||||
case .timeline:
|
||||
return .timeline
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ enum Tracing {
|
||||
|
||||
static let fileExtension = "log"
|
||||
|
||||
static func buildConfiguration(logLevel: LogLevel, currentTarget: String, filePrefix: String?) -> TracingConfiguration {
|
||||
static func buildConfiguration(logLevel: LogLevel, traceLogPacks: Set<TraceLogPack>, currentTarget: String, filePrefix: String?) -> TracingConfiguration {
|
||||
let fileName = if let filePrefix {
|
||||
"\(Tracing.filePrefix)-\(filePrefix)"
|
||||
} else {
|
||||
@@ -39,6 +39,7 @@ enum Tracing {
|
||||
let level: LogLevel = ProcessInfo.isRunningIntegrationTests ? .trace : logLevel
|
||||
|
||||
return .init(logLevel: level.rustLogLevel,
|
||||
traceLogPacks: traceLogPacks.map(\.rustLogPack),
|
||||
extraTargets: [currentTarget],
|
||||
writeToStdoutOrSystem: true,
|
||||
writeToFiles: .init(path: logsDirectory.path(percentEncoded: false),
|
||||
|
||||
Reference in New Issue
Block a user