Skip to content

Instantly share code, notes, and snippets.

@bill350
Last active July 26, 2018 12:52
Show Gist options
  • Save bill350/3bd2e3e94ad0f5c17c121135ed53d79d to your computer and use it in GitHub Desktop.
Save bill350/3bd2e3e94ad0f5c17c121135ed53d79d to your computer and use it in GitHub Desktop.
func createOSLog(context: Any?) -> OSLog {
var currentContext = "Default"
if let loggerContext = context as? String {
currentContext = loggerContext
}
let subsystem = Bundle.main.bundleIdentifier ?? "com.logger.default"
let customLog = OSLog(subsystem: subsystem, category: currentContext)
return customLog
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment