Skip to content

Instantly share code, notes, and snippets.

@akramhussein
Created August 11, 2015 15:07
Show Gist options
  • Save akramhussein/3c4665aabe15cfafbac2 to your computer and use it in GitHub Desktop.
Save akramhussein/3c4665aabe15cfafbac2 to your computer and use it in GitHub Desktop.
CocoaLumberjack Custom Crashlytics Logger in Swift
import Foundation
import CocoaLumberjack
import Crashlytics
class CrashlyticsLogger : DDAbstractLogger
{
static let sharedInstance = CrashlyticsLogger()
private var _logFormatter : DDLogFormatter?
override var logFormatter: DDLogFormatter? {
get {
return _logFormatter
}
set {
_logFormatter = newValue
}
}
override func logMessage(logMessage: DDLogMessage)
{
guard let formatter = self.logFormatter
else
{
print("CrashlyticsLogger: No formatter")
return
}
let formattedMessage = formatter.formatLogMessage(logMessage)
CLSLogv(formattedMessage, getVaList([]))
}
}
@djvistasa
Copy link

Tried to implement this but am wondering where CustomLogFormatter() is defined?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment