Feature: try add crash logger
This commit is contained in:
parent
530fda3ade
commit
aff909a966
@ -44,6 +44,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
signal(SIGPIPE, SIG_IGN)
|
||||
|
||||
failLaunchProtect()
|
||||
registCrashLogger()
|
||||
|
||||
_ = ProxyConfigManager.install()
|
||||
ConfigFileFactory.upgardeIniIfNeed()
|
||||
@ -163,6 +164,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func registCrashLogger() {
|
||||
func exceptionHandler(exception : NSException) {
|
||||
print(exception)
|
||||
print(exception.callStackSymbols)
|
||||
let str = exception.callStackSymbols.joined(separator: "\n")
|
||||
Logger.log(msg: str, level: .error)
|
||||
}
|
||||
NSSetUncaughtExceptionHandler(exceptionHandler)
|
||||
}
|
||||
|
||||
func failLaunchProtect(){
|
||||
let x = UserDefaults.standard
|
||||
var launch_fail_times:Int = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user