Skip to content

Commit 3ced429

Browse files
committed
Turned example code into a commented out example
1 parent 907152b commit 3ced429

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Common/Tracery.Logging.swift

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
import Foundation
1010

11+
// EXAMPLE OF A LOGGING FUNCTION
12+
// func notificationLog(_ message: String) {
13+
// // install via Tracery.logTarget = notificationLog
14+
// NotificationCenter.default.post(name: Notification.Name("Tracery.log"), object: nil, userInfo: ["message":message])
15+
// }
16+
1117

1218
extension Tracery {
1319

@@ -26,15 +32,10 @@ extension Tracery {
2632
// standard logger to standard output
2733
print(message)
2834
}
29-
30-
fileprivate static func notificationLog(_ message: String) {
31-
// install via setting logTarget to this function instead of the above
32-
NotificationCenter.default.post(name: Notification.Name("Tracery.log"), object: nil, userInfo: ["message":message])
33-
}
34-
35-
static func log(level: LoggingLevel, message: @autoclosure () -> String) {
35+
36+
public static func log(level: LoggingLevel, message: @autoclosure () -> String) {
3637
guard logLevel.rawValue >= level.rawValue else { return }
37-
stdLog(message())
38+
logTarget(message())
3839
}
3940

4041
func trace(_ message: @autoclosure () -> String) {

0 commit comments

Comments
 (0)