Skip to content

Instantly share code, notes, and snippets.

@reyandrey
Last active June 19, 2020 18:01
Show Gist options
  • Save reyandrey/5387c83365159141cdaabd67af264209 to your computer and use it in GitHub Desktop.
Save reyandrey/5387c83365159141cdaabd67af264209 to your computer and use it in GitHub Desktop.
Log
import Foundation
import os.log
public class Log<T> {
private let log: OSLog
public init(){
self.log = OSLog(subsystem: Bundle.main.bundleIdentifier ?? "unknown", category: String(describing: T.self))
}
public func debug(_ message: String) {
os_log("%@", log: log, type: .debug, message)
}
public func error(_ message: String) {
os_log("%@", log: log, type: .error, message)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment