File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,21 @@ extension Tracery {
20
20
}
21
21
22
22
public static var logLevel = LoggingLevel . errors
23
-
23
+ public static var logTarget : ( String ) -> Void = stdLog
24
+
25
+ fileprivate static func stdLog( _ message: String ) {
26
+ // standard logger to standard output
27
+ print ( message)
28
+ }
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
+
24
35
static func log( level: LoggingLevel , message: @autoclosure ( ) -> String ) {
25
36
guard logLevel. rawValue >= level. rawValue else { return }
26
- print ( message ( ) )
27
- // NotificationCenter.default.post(name: Notification.Name("Tracery.log"), object: nil, userInfo: ["message":message()])
37
+ stdLog ( message ( ) )
28
38
}
29
39
30
40
func trace( _ message: @autoclosure ( ) -> String ) {
You can’t perform that action at this time.
0 commit comments