Created
December 10, 2015 21:00
-
-
Save jimrutherford/45223f46befd0de96589 to your computer and use it in GitHub Desktop.
SwiftyBeaver Crashlyitcs Log Destination
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CrashlyticsDestination.swift | |
// | |
// Created by Jim Rutherford on 2015-12-10. | |
// | |
import UIKit | |
import Crashlytics | |
public class CrashlyticsDestination: BaseDestination { | |
override var defaultHashValue: Int {return 3} | |
public override init() { | |
super.init() | |
self.colored = false | |
} | |
// print to Xcode Console. uses full base class functionality | |
override func send(level: SwiftyBeaver.Level, msg: String, path: String, function: String, line: Int) -> String? { | |
let formattedString = super.send(level, msg: msg, path: path, function: function, line: line) | |
if let str = formattedString { | |
CLSLogv(str, getVaList([])) | |
} | |
return formattedString | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There will be a crash when
str = "%d %@"
.You should replace
CLSLogv(str, getVaList([]))
withCLSLogv("%@", getVaList([ str ]))