2022-03-04 23:58:07 +00:00
|
|
|
import SwiftyBeaver
|
|
|
|
|
|
|
|
private let log = SwiftyBeaver.self
|
|
|
|
|
|
|
|
extension OSLogType {
|
|
|
|
var sbLevel: SwiftyBeaver.Level {
|
|
|
|
switch self {
|
|
|
|
case .debug:
|
|
|
|
return .debug
|
|
|
|
|
|
|
|
case .info:
|
|
|
|
return .info
|
|
|
|
|
|
|
|
case .error, .fault:
|
|
|
|
return .error
|
|
|
|
|
|
|
|
default:
|
|
|
|
return .info
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-01 12:54:00 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import os.log
|
|
|
|
|
|
|
|
public func wg_log(_ type: OSLogType, staticMessage msg: StaticString) {
|
|
|
|
os_log(msg, log: OSLog.default, type: type)
|
2022-03-04 23:58:07 +00:00
|
|
|
log.custom(level: type.sbLevel, message: msg, context: nil)
|
2021-12-01 12:54:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public func wg_log(_ type: OSLogType, message msg: String) {
|
|
|
|
os_log("%{public}s", log: OSLog.default, type: type, msg)
|
2022-03-04 23:58:07 +00:00
|
|
|
log.custom(level: type.sbLevel, message: msg, context: nil)
|
2021-12-01 12:54:00 +00:00
|
|
|
}
|