OAuth2
OAuth2 copied to clipboard
Implementing OAuth2Logger protocol invokes the default implementation.
trafficstars
open class OAuth2CustomLogger: OAuth2Logger{
/// The logger's logging level.
public var level: OAuth2LogLevel
/** Designated initializer. */
public init(_ level: OAuth2LogLevel = OAuth2LogLevel.debug) {
self.level = level
}
/** Log a message at the trace level. */
public func trace(_ module: String? = "OAuth2", filename: String? = #file, line: Int? = #line, function: String? = #function, msg: @autoclosure() -> String) {
DDLogVerbose("\(module ?? ""): \(msg())")
}
/** Standard debug logging. */
public func debug(_ module: String? = "OAuth2", filename: String? = #file, line: Int? = #line, function: String? = #function, msg: @autoclosure() -> String) {
DDLogDebug("\(module ?? ""): \(msg())")
}
/** Log warning messages. */
public func warn(_ module: String? = "OAuth2", filename: String? = #file, line: Int? = #line, function: String? = #function, msg: @autoclosure() -> String) {
DDLogError("\(module ?? ""): \(msg())")
}
}
This is my implementation and I register with the OAuth2 object
oauth2.logger = OAuth2CustomLogger(OAuth2LogLevel.trace) but still OAuth2.authorize() method gets into the default log implementation and write the log to console.
Is this the same as #236 ?
Yes, that looks correct. Any plans to push to release anytime soon? Thanks, Pascal!!