Skip to content

Instantly share code, notes, and snippets.

@bill350
Last active July 26, 2018 12:39
Show Gist options
  • Save bill350/834fd604712a5decbd7a6d2747b4de80 to your computer and use it in GitHub Desktop.
Save bill350/834fd604712a5decbd7a6d2747b4de80 to your computer and use it in GitHub Desktop.
// MARK: OSLog extension
extension SwiftyBeaver {
private static var osLogDestination: OSLogDestination = {
#if DEBUG
let level: SwiftyBeaver.Level = .verbose
#else
let level: SwiftyBeaver.Level = .error
#endif
let osLogDestination = OSLogDestination(level: level)
return osLogDestination
}()
static func setOSLog(enabled: Bool) {
if enabled {
logger.addDestination(SwiftyBeaver.osLogDestination)
} else {
logger.removeDestination(SwiftyBeaver.osLogDestination)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment