Skip to content

Instantly share code, notes, and snippets.

@digitaljerry
Last active April 17, 2019 14:29
Show Gist options
  • Save digitaljerry/f8205ea6305f8e5abf75b44b50e436f9 to your computer and use it in GitHub Desktop.
Save digitaljerry/f8205ea6305f8e5abf75b44b50e436f9 to your computer and use it in GitHub Desktop.
SwiftyBeaver destination used to log info warning and error traces using Crashlytics Raw
public class CrashlyticsDestination: BaseDestination {
open override func send(_ level: SwiftyBeaver.Level, msg traceMessage: String, thread traceThread: String, file traceFile: String,
function traceFunction: String, line traceLine: Int, context _: Any? = nil) -> String? {
if level.rawValue >= SwiftyBeaver.Level.info.rawValue {
let userInfo: [String: Any] = [
"Level": level.rawValue,
"Msg": traceMessage,
"File": traceFile,
"Function": traceFunction,
"Line": traceLine
]
CLSLogv("%@", getVaList([userInfo]))
}
return super.send(level, msg: traceMessage, thread: traceThread, file: traceFile, function: traceFunction, line: traceLine)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment