rewrite log service

This commit is contained in:
Danmei Chen 2021-01-29 17:32:14 +01:00
parent b62fe18ff3
commit 5a30382991

View file

@ -33,13 +33,11 @@ class LinphoneLoggingServiceManager: LoggingServiceDelegate {
let debugLevel = config.getInt(section: "app", key: "debugenable_preference", defaultValue: LogLevel.Debug.rawValue)
let debugEnabled = (debugLevel >= LogLevel.Debug.rawValue && debugLevel < LogLevel.Error.rawValue)
if (debugEnabled) {
Factory.Instance.logCollectionPath = Factory.Instance.getDownloadDir(context: UnsafeMutablePointer<Int8>(mutating: (APP_GROUP_ID as NSString).utf8String))
Factory.Instance.enableLogCollection(state: LogCollectionState.Enabled)
log.domain = domain
log.logLevel = LogLevel(rawValue: debugLevel)
log.addDelegate(delegate: self)
}
Factory.Instance.logCollectionPath = Factory.Instance.getDownloadDir(context: UnsafeMutablePointer<Int8>(mutating: (APP_GROUP_ID as NSString).utf8String))
Factory.Instance.enableLogCollection(state: debugEnabled ? LogCollectionState.Enabled : LogCollectionState.Disabled)
log.domain = domain
log.logLevel = debugLevel==0 ? LogLevel.Fatal : LogLevel(rawValue: debugLevel)
log.addDelegate(delegate: self)
} else {
throw LinphoneError.loggingServiceUninitialized
}