mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Structured logging (#831)
* Structured logging support * Bump the SDK, fix breaking changes * Enabled more logging of timeline diffs * Keep only source file last path components in logs * Bump the SDK, tweaks following code review
This commit is contained in:
@@ -51,10 +51,11 @@ class AppCoordinator: AppCoordinatorProtocol {
|
||||
@Consumable private var storedAppRoute: AppRoute?
|
||||
|
||||
init() {
|
||||
MXLog.configure()
|
||||
|
||||
navigationRootCoordinator = NavigationRootCoordinator()
|
||||
|
||||
Self.setupServiceLocator(navigationRootCoordinator: navigationRootCoordinator)
|
||||
Self.setupLogging()
|
||||
|
||||
ServiceLocator.shared.analytics.startIfEnabled()
|
||||
|
||||
@@ -118,26 +119,6 @@ class AppCoordinator: AppCoordinatorProtocol {
|
||||
ServiceLocator.shared.register(analytics: Analytics(client: PostHogAnalyticsClient()))
|
||||
}
|
||||
|
||||
private static func setupLogging() {
|
||||
let loggerConfiguration = MXLogConfiguration()
|
||||
loggerConfiguration.maxLogFilesCount = 10
|
||||
|
||||
#if DEBUG
|
||||
setupTracing(configuration: .debug)
|
||||
loggerConfiguration.logLevel = .debug
|
||||
#else
|
||||
setupTracing(configuration: .release)
|
||||
loggerConfiguration.logLevel = .info
|
||||
#endif
|
||||
|
||||
// Avoid redirecting NSLogs to files if we are attached to a debugger.
|
||||
if isatty(STDERR_FILENO) == 0 {
|
||||
loggerConfiguration.redirectLogsToFiles = true
|
||||
}
|
||||
|
||||
MXLog.configure(loggerConfiguration)
|
||||
}
|
||||
|
||||
/// Perform any required migrations for the app to function correctly.
|
||||
private func performMigrationsIfNecessary(from oldVersion: Version, to newVersion: Version) {
|
||||
guard oldVersion != newVersion else { return }
|
||||
|
||||
@@ -19,13 +19,15 @@ import SwiftUI
|
||||
@main
|
||||
struct Application: App {
|
||||
@UIApplicationDelegateAdaptor(AppDelegate.self) private var applicationDelegate
|
||||
private let applicationCoordinator: AppCoordinatorProtocol
|
||||
private let appCoordinator: AppCoordinatorProtocol!
|
||||
|
||||
init() {
|
||||
if Tests.isRunningUITests {
|
||||
applicationCoordinator = UITestsAppCoordinator()
|
||||
appCoordinator = UITestsAppCoordinator()
|
||||
} else if Tests.isRunningUnitTests {
|
||||
appCoordinator = nil
|
||||
} else {
|
||||
applicationCoordinator = AppCoordinator()
|
||||
appCoordinator = AppCoordinator()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +36,9 @@ struct Application: App {
|
||||
if Tests.isRunningUnitTests {
|
||||
EmptyView()
|
||||
} else {
|
||||
applicationCoordinator.toPresentable()
|
||||
appCoordinator.toPresentable()
|
||||
.task {
|
||||
applicationCoordinator.start()
|
||||
appCoordinator.start()
|
||||
}
|
||||
.statusBarHidden(shouldHideStatusBar)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user