mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-24 02:00:24 +07:00
34 lines
645 B
Swift
34 lines
645 B
Swift
|
|
import Foundation
|
||
|
|
|
||
|
|
public func swiftUpdateLogData(_ qtString: std.string) -> std.string {
|
||
|
|
let qtLog = Log(String(describing: qtString))
|
||
|
|
var log = qtLog
|
||
|
|
|
||
|
|
if let appLog = Log(at: Log.appLogURL) {
|
||
|
|
appLog.records.forEach {
|
||
|
|
log.records.append($0)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if let neLog = Log(at: Log.neLogURL) {
|
||
|
|
neLog.records.forEach {
|
||
|
|
log.records.append($0)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
log.records.sort {
|
||
|
|
$0.date < $1.date
|
||
|
|
}
|
||
|
|
|
||
|
|
return std.string(log.description)
|
||
|
|
}
|
||
|
|
|
||
|
|
public func swiftDeleteLog() {
|
||
|
|
Log.clear(at: Log.appLogURL)
|
||
|
|
Log.clear(at: Log.neLogURL)
|
||
|
|
}
|
||
|
|
|
||
|
|
public func toggleLogging(_ isEnabled: Bool) {
|
||
|
|
Log.isLoggingEnabled = isEnabled
|
||
|
|
}
|