For this I created a "custom" assertion that also supports the use of CocoaLumberjack and has a "hack" to throw exceptions when the assertion fails (instead of just aborting).
The assertion has a couple of possible "configurations" explained below.
- Assertion supports the use of CocoaLumberjack [GitHub Repo] for more detailed logging.
- In order to use it you need to set the PREPROCESSOR macro USE_LUMBERJACK=1 and configure the loggers for CocoaLumberjack (demo app does this)
- Assertion also supports a "hack" to make the assertion reach the CrashReport via a flag that will output the assert as an exception.
Note: The "extra" data will just appear in the CrashReport pointing to the line where the assertion was called.- To do this specify the PREPROCESSOR macro kSHOULD_THROW_EXCEPTION=1 and this will make the assertion to build a "custom" exception with the following data:
- Message: Assertion Failure - #expression
- Reason: #expression
- User Info:
- File: File name where the assertion failed
- Line: Line number on the file where the assertion failed
- Function: The name of the function where the assertion failed
- Message: The custom message provided to the assertion (if any)
- To do this specify the PREPROCESSOR macro kSHOULD_THROW_EXCEPTION=1 and this will make the assertion to build a "custom" exception with the following data:
- Add support for FlurrySDK (Logging the custom exception to Flurry as a way to reach all the possible data)
- Add support for Crittercism (Same as FlurrySDK)
- Add an automatic way of sending the CocoaLumberjack logs compressed to a desired location
Icon was taken from IconFinder.com
And used under this license