OAuth2 icon indicating copy to clipboard operation
OAuth2 copied to clipboard

Implementing OAuth2Logger protocol invokes the default implementation.

Open sujankota opened this issue 7 years ago • 2 comments
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.

sujankota avatar Aug 11 '18 01:08 sujankota

Is this the same as #236 ?

p2 avatar Aug 15 '18 23:08 p2

Yes, that looks correct. Any plans to push to release anytime soon? Thanks, Pascal!!

sujankota avatar Aug 16 '18 22:08 sujankota