Dispatch system log messages
Print device log messages
With the MintLog function you can print messages to the console using the Apple Logging System (ALS). When in debug mode, all messages are displayed in the console window and printed to the device log. When in release mode, all messages are displayed in the console window, but only notice messages and higher are printed to the device log.
Log Level | Suggested Usage |
---|---|
Emergency (level 0) | The highest priority, usually reserved for catastrophic failures and reboot notices. |
Alert (level 1) | A serious failure in a key system. |
Critical (level 2) | A failure in a key system. |
Error (level 3) | Something has failed. |
Warning (level 4) | Something is amiss and might fail if not corrected. |
Notice (level 5) | Things of moderate interest to the user or administrator. |
Info (level 6) | The lowest priority that you would normally log, and purely informational in nature. |
Debug (level 7) | The lowest priority, and normally not logged except for messages from the kernel. |
Report console log messages
To dispatch the latest NSLog messages with your unhandled crash, use the following methods before calling initAndStartSessionWithAPIKey:
- enableMintLoggingCache: enables log caching.
- enableLogging: attaches the cached log to exceptions.
- setLogging: specifies the number of lines to include.
Example code
// Objective-C [[Mint sharedInstance] enableMintLoggingCache:YES]; [[Mint sharedInstance] enableLogging:YES]; [[Mint sharedInstance] setLogging:8]; [[Mint sharedInstance] initAndStartSessionWithAPIKey:@"API_KEY"];
// Swift Mint.sharedInstance().enableMintLoggingCache(true) Mint.sharedInstance().enableLogging(true) Mint.sharedInstance().setLogging(8) Mint.sharedInstance().initAndStartSessionWithAPIKey("API_KEY")
Using this code, your unhandled crash reports will include the last eight NSLog messages with the request, which you can then examine from the error instances.
Add and report events | Report handled exceptions |
This documentation applies to the following versions of Splunk MINT™ SDK for iOS (Legacy): 5.2.x
Feedback submitted, thanks!