Customize WireGuard debug log format
This commit is contained in:
parent
f1bdc8490c
commit
3bdff1ee8b
|
@ -813,7 +813,7 @@ extension OpenVPNTunnelProvider {
|
||||||
|
|
||||||
// MARK: Logging
|
// MARK: Logging
|
||||||
|
|
||||||
private func configureLogging(debug: Bool, customFormat: String? = nil) {
|
private func configureLogging(debug: Bool, customFormat: String?) {
|
||||||
let logLevel: SwiftyBeaver.Level = (debug ? debugLogLevel : .info)
|
let logLevel: SwiftyBeaver.Level = (debug ? debugLogLevel : .info)
|
||||||
let logFormat = customFormat ?? "$Dyyyy-MM-dd HH:mm:ss.SSS$d $L $N.$F:$l - $M"
|
let logFormat = customFormat ?? "$Dyyyy-MM-dd HH:mm:ss.SSS$d $L $N.$F:$l - $M"
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ open class WireGuardTunnelProvider: NEPacketTunnelProvider {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
configureLogging(debug: cfg.shouldDebug)
|
configureLogging(debug: cfg.shouldDebug, customFormat: cfg.debugLogFormat)
|
||||||
|
|
||||||
// END: TunnelKit
|
// END: TunnelKit
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ open class WireGuardTunnelProvider: NEPacketTunnelProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension WireGuardTunnelProvider {
|
extension WireGuardTunnelProvider {
|
||||||
private func configureLogging(debug: Bool, customFormat: String? = nil) {
|
private func configureLogging(debug: Bool, customFormat: String?) {
|
||||||
let logLevel: SwiftyBeaver.Level = (debug ? .debug : .info)
|
let logLevel: SwiftyBeaver.Level = (debug ? .debug : .info)
|
||||||
let logFormat = customFormat ?? "$Dyyyy-MM-dd HH:mm:ss.SSS$d $L $N.$F:$l - $M"
|
let logFormat = customFormat ?? "$Dyyyy-MM-dd HH:mm:ss.SSS$d $L $N.$F:$l - $M"
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ extension WireGuard {
|
||||||
|
|
||||||
public var shouldDebug = false
|
public var shouldDebug = false
|
||||||
|
|
||||||
|
public var debugLogFormat: String? = nil
|
||||||
|
|
||||||
public init(_ title: String, appGroup: String, configuration: WireGuard.Configuration) {
|
public init(_ title: String, appGroup: String, configuration: WireGuard.Configuration) {
|
||||||
self.title = title
|
self.title = title
|
||||||
self.appGroup = appGroup
|
self.appGroup = appGroup
|
||||||
|
|
Loading…
Reference in New Issue