Skip to content

Commit c456a82

Browse files
committed
Fix issue with custom logger
Fixes p2#236
1 parent 7075dbd commit c456a82

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/Base/OAuth2Logger.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ public protocol OAuth2Logger {
6969
/// The logger's logging level.
7070
var level: OAuth2LogLevel { get }
7171

72+
/** This is made a protocol method so it can be implemented in `extension OAuth2Logger` **and** you're able to create your own class
73+
that overrides this method so you can write your own implementation. */
74+
func log(_ atLevel: OAuth2LogLevel, module: String?, filename: String?, line: Int?, function: String?, msg: @autoclosure() -> String)
75+
7276
/** Log a message at the trace level. */
7377
func trace(_ module: String?, filename: String?, line: Int?, function: String?, msg: @autoclosure() -> String)
7478

@@ -84,6 +88,8 @@ extension OAuth2Logger {
8488
/**
8589
The main log method, figures out whether to log the given message based on the receiver's logging level, then just uses `print`. Ignores
8690
filename, line and function.
91+
If you override this method in your own logger there's no need to override the `trace`, `debug` and `warn` methods implemented below as
92+
they all call out to this one.
8793
*/
8894
public func log(_ atLevel: OAuth2LogLevel, module: String?, filename: String?, line: Int?, function: String?, msg: @autoclosure() -> String) {
8995
if level != .off && atLevel.rawValue >= level.rawValue {

0 commit comments

Comments
 (0)