Skip to content

Instantly share code, notes, and snippets.

@hudinwal
Created July 25, 2017 06:58
Show Gist options
  • Save hudinwal/d726481d6376eedda37328d9a14d0e0e to your computer and use it in GitHub Desktop.
Save hudinwal/d726481d6376eedda37328d9a14d0e0e to your computer and use it in GitHub Desktop.
Custom Logs and keys
import UIKit
import Crashlytics
class CrashTrackerController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
CLSLogv("CONTROLLER_DID_LOAD - %@",getVaList([self.className]))
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Set the log
CLSLogv("CONTROLLER_DID_APPEAR - %@",getVaList([self.className]))
// Set the key
Crashlytics.sharedInstance().setObjectValue(self.className, forKey: "CONTROLLER_APPEARED")
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
// Set the log
CLSLogv("CONTROLLER_DID_DISAPPEAR - %@",getVaList([self.className]))
// Set the key
Crashlytics.sharedInstance().setObjectValue(self.className, forKey: "CONTROLLER_DISAPPEARED")
}
deinit {
CLSLogv("CONTROLLER_DEALLOCATED - %@",getVaList([self.className]))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment