Created
August 11, 2015 15:07
-
-
Save akramhussein/3c4665aabe15cfafbac2 to your computer and use it in GitHub Desktop.
CocoaLumberjack Custom Crashlytics Logger in Swift
This file contains 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
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([])) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tried to implement this but am wondering where CustomLogFormatter() is defined?