mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Setup the new RustSDK sentry integration
This commit is contained in:
committed by
Stefan Ceriu
parent
803e4198ea
commit
b3f0c31b9d
@@ -5,6 +5,7 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
@MainActor
|
||||
@@ -16,38 +17,50 @@ enum Target: String {
|
||||
|
||||
private static var isConfigured = false
|
||||
|
||||
func configure(logLevel: LogLevel, traceLogPacks: Set<TraceLogPack>) {
|
||||
func configure(logLevel: LogLevel, traceLogPacks: Set<TraceLogPack>, sentryURL: URL?) {
|
||||
guard !Self.isConfigured else {
|
||||
return
|
||||
}
|
||||
|
||||
switch self {
|
||||
case .mainApp:
|
||||
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
|
||||
traceLogPacks: traceLogPacks,
|
||||
currentTarget: rawValue,
|
||||
filePrefix: nil)
|
||||
try? initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: false)
|
||||
case .nse:
|
||||
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
|
||||
traceLogPacks: traceLogPacks,
|
||||
currentTarget: rawValue,
|
||||
filePrefix: rawValue)
|
||||
try? initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: true)
|
||||
case .shareExtension:
|
||||
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
|
||||
traceLogPacks: traceLogPacks,
|
||||
currentTarget: rawValue,
|
||||
filePrefix: rawValue)
|
||||
try? initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: true)
|
||||
case .tests:
|
||||
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
|
||||
traceLogPacks: traceLogPacks,
|
||||
currentTarget: rawValue,
|
||||
filePrefix: rawValue)
|
||||
try? initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: false)
|
||||
do {
|
||||
switch self {
|
||||
case .mainApp:
|
||||
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
|
||||
traceLogPacks: traceLogPacks,
|
||||
currentTarget: rawValue,
|
||||
filePrefix: nil,
|
||||
sentryURL: sentryURL)
|
||||
try initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: false)
|
||||
case .nse:
|
||||
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
|
||||
traceLogPacks: traceLogPacks,
|
||||
currentTarget: rawValue,
|
||||
filePrefix: rawValue,
|
||||
sentryURL: sentryURL)
|
||||
try initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: true)
|
||||
case .shareExtension:
|
||||
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
|
||||
traceLogPacks: traceLogPacks,
|
||||
currentTarget: rawValue,
|
||||
filePrefix: rawValue,
|
||||
sentryURL: sentryURL)
|
||||
try initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: true)
|
||||
case .tests:
|
||||
let tracingConfiguration = Tracing.buildConfiguration(logLevel: logLevel,
|
||||
traceLogPacks: traceLogPacks,
|
||||
currentTarget: rawValue,
|
||||
filePrefix: rawValue,
|
||||
sentryURL: sentryURL)
|
||||
try initPlatform(config: tracingConfiguration, useLightweightTokioRuntime: false)
|
||||
}
|
||||
} catch {
|
||||
fatalError("Failed configuring target \(self) with error: \(error)")
|
||||
}
|
||||
|
||||
// Setup sentry above but disable it by default. It will be started
|
||||
// later together with the analytics service if the user consents.
|
||||
enableSentryLogging(enabled: false)
|
||||
|
||||
MXLog.configure(currentTarget: rawValue)
|
||||
|
||||
Self.isConfigured = true
|
||||
|
||||
Reference in New Issue
Block a user