mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-24 00:27:40 +00:00
Merge pull request #4500 from keymanapp/fix/ios/system-logs
fix(ios): app logging messages were transient, never stored
This commit is contained in:
commit
962cf96bbe
6 changed files with 55 additions and 21 deletions
|
|
@ -8,4 +8,27 @@
|
|||
|
||||
import XCGLogger
|
||||
|
||||
public let log = XCGLogger(identifier: "KeymanEngine", includeDefaultDestinations: true)
|
||||
// From XCGLogger docs:
|
||||
// Note: This creates the log object lazily, which means it's not created until it's actually needed.
|
||||
public let log: XCGLogger = {
|
||||
// Default: the 'console', which is read by Xcode but doesn't reach the system logs.
|
||||
let mainLog = XCGLogger(identifier: "KeymanEngine", includeDefaultDestinations: false)
|
||||
|
||||
// Ensures our log messages go out to the device's system log as well as the console.
|
||||
let systemLogDest = AppleSystemLogDestination(identifier: "")
|
||||
systemLogDest.showLogIdentifier = true
|
||||
|
||||
mainLog.add(destination: systemLogDest)
|
||||
|
||||
// Temporary logging level to ensure that app details are reported properly.
|
||||
mainLog.outputLevel = .info
|
||||
mainLog.logAppDetails()
|
||||
|
||||
#if DEBUG
|
||||
mainLog.outputLevel = .debug
|
||||
#else
|
||||
mainLog.outputLevel = .warning
|
||||
#endif
|
||||
|
||||
return mainLog
|
||||
}()
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
|
||||
func application(_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {
|
||||
KeymanEngine.log.outputLevel = .debug
|
||||
KeymanEngine.log.logAppDetails()
|
||||
Manager.applicationGroupIdentifier = "group.KMEI"
|
||||
Manager.shared.canRemoveDefaultKeyboard = true
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ import KeymanEngine
|
|||
|
||||
class KeyboardViewController: InputViewController {
|
||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
|
||||
KeymanEngine.log.outputLevel = .debug
|
||||
KeymanEngine.log.logAppDetails()
|
||||
_ = log // forces init of the log, which is useful in sys-kbd contexts.
|
||||
Manager.applicationGroupIdentifier = "group.KMEI"
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,20 +54,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
func application(_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
||||
SentryManager.start()
|
||||
// Forces the logs to initialize, as their definitions result in lazy init.
|
||||
// These references have been configured to also log app details.
|
||||
_ = log
|
||||
_ = KeymanEngine.log
|
||||
|
||||
UniversalLinks.externalLinkLauncher = { url in
|
||||
UIApplication.shared.openURL(url)
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
KeymanEngine.log.outputLevel = .debug
|
||||
log.outputLevel = .debug
|
||||
KeymanEngine.log.logAppDetails()
|
||||
#else
|
||||
KeymanEngine.log.outputLevel = .warning
|
||||
log.outputLevel = .warning
|
||||
#endif
|
||||
|
||||
Manager.applicationGroupIdentifier = "group.KM4I"
|
||||
|
||||
// TODO: Assign a subclassed version of InputViewController that implements the image stuff.
|
||||
|
|
|
|||
|
|
@ -8,4 +8,27 @@
|
|||
|
||||
import XCGLogger
|
||||
|
||||
let log = XCGLogger(identifier: "Keyman", includeDefaultDestinations: true)
|
||||
// From XCGLogger docs:
|
||||
// Note: This creates the log object lazily, which means it's not created until it's actually needed.
|
||||
public let log: XCGLogger = {
|
||||
// Default: the 'console', which is read by Xcode but doesn't reach the system logs.
|
||||
let mainLog = XCGLogger(identifier: "Keyman", includeDefaultDestinations: false)
|
||||
|
||||
// Ensures our log messages go out to the device's system log as well as the console.
|
||||
let systemLogDest = AppleSystemLogDestination(identifier: "")
|
||||
systemLogDest.showLogIdentifier = true
|
||||
|
||||
mainLog.add(destination: systemLogDest)
|
||||
|
||||
// Temporary logging level to ensure that app details are reported properly.
|
||||
mainLog.outputLevel = .info
|
||||
mainLog.logAppDetails()
|
||||
|
||||
#if DEBUG
|
||||
mainLog.outputLevel = .debug
|
||||
#else
|
||||
mainLog.outputLevel = .warning
|
||||
#endif
|
||||
|
||||
return mainLog
|
||||
}()
|
||||
|
|
|
|||
|
|
@ -21,13 +21,9 @@ class KeyboardViewController: InputViewController {
|
|||
// is enabled. They seem to get blocked otherwise, except in the Simulator.
|
||||
SentryManager.start(sendingEnabled: true)
|
||||
}
|
||||
_ = log
|
||||
_ = KeymanEngine.log
|
||||
|
||||
#if DEBUG
|
||||
KeymanEngine.log.outputLevel = .debug
|
||||
KeymanEngine.log.logAppDetails()
|
||||
#else
|
||||
KeymanEngine.log.outputLevel = .warning
|
||||
#endif
|
||||
Manager.applicationGroupIdentifier = "group.KM4I"
|
||||
|
||||
let bundle = Bundle(for: KeyboardViewController.self)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue