Allow customization of debug log level

This commit is contained in:
Davide De Rosa 2019-12-12 09:42:48 +01:00
parent 0f2bf8cf48
commit 5b0df2eada
1 changed files with 4 additions and 1 deletions

View File

@ -57,6 +57,9 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
/// The maximum number of lines in the log. /// The maximum number of lines in the log.
public var maxLogLines = 1000 public var maxLogLines = 1000
/// The log level when `OpenVPNTunnelProvider.Configuration.shouldDebug` is enabled.
public var debugLogLevel: SwiftyBeaver.Level = .debug
/// The number of milliseconds after which a DNS resolution fails. /// The number of milliseconds after which a DNS resolution fails.
public var dnsTimeout = 3000 public var dnsTimeout = 3000
@ -772,7 +775,7 @@ extension OpenVPNTunnelProvider {
// MARK: Logging // MARK: Logging
private func configureLogging(debug: Bool, customFormat: String? = nil) { private func configureLogging(debug: Bool, customFormat: String? = nil) {
let logLevel: SwiftyBeaver.Level = (debug ? .debug : .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"
if debug { if debug {