feat: add proper timestamp to PacketTunnelProviderLogs

This commit is contained in:
Oleg Dreyman
2020-10-14 12:30:33 +03:00
parent a5231fb5d1
commit 0104c80cb4

View File

@@ -56,9 +56,17 @@ func getUserWantsVPNEnabled() -> Bool {
enum PacketTunnelProviderLogs {
static let dateFormatter: DateFormatter = {
$0.dateFormat = "yyyy-MM-dd HH:mm:ss"
$0.formatterBehavior = .behavior10_4
$0.locale = .init(identifier: "en_US_POSIX")
return $0
}(DateFormatter())
static let userDefaultsKey = "com.confirmed.lockdown.ne_temporaryLogs"
static func log(_ string: String) {
let string = "\(dateFormatter.string(from: Date())) \(string)"
if var array = defaults.stringArray(forKey: userDefaultsKey) {
array.append(string)
defaults.setValue(array, forKey: userDefaultsKey)