Browse Source

Only log for debug builds.

master
Abhishek Banthia 7 months ago
parent
commit
2c91af2924
  1. 16
      Clocker/CoreLoggerKit/Sources/CoreLoggerKit/Logger.swift

16
Clocker/CoreLoggerKit/Sources/CoreLoggerKit/Logger.swift

@ -9,15 +9,19 @@ public class Logger: NSObject {
let logObjc = OSLog(subsystem: "com.abhishek.Clocker", category: "app") let logObjc = OSLog(subsystem: "com.abhishek.Clocker", category: "app")
public class func log(object annotations: [String: Any]?, for event: NSString) { public class func log(object annotations: [String: Any]?, for event: NSString) {
if #available(OSX 10.14, *) { #if DEBUG
os_log(.default, "[%@] - [%@]", event, annotations ?? [:]) if #available(OSX 10.14, *) {
} os_log(.default, "[%@] - [%@]", event, annotations ?? [:])
}
#endif
} }
public class func info(_ message: String) { public class func info(_ message: String) {
if #available(OSX 10.14, *) { #if DEBUG
os_log(.info, "%@", message) if #available(OSX 10.14, *) {
} os_log(.info, "%@", message)
}
#endif
} }
} }

Loading…
Cancel
Save