NimbusKit
1.2.1 - Fork Nimbus on Github - Visit the Nimbus Wiki
The iOS framework that grows only as fast as its documentation
|
Macros | |
#define | NIDPRINT(xx,...) NSLog(@"%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) |
#define | NIDPRINTMETHODNAME() NIDPRINT(@"%s", __PRETTY_FUNCTION__) |
#define | NIDCONDITIONLOG(condition, xx,...) |
#define | NIDERROR(xx,...) NIDCONDITIONLOG((NILOGLEVEL_ERROR <= NIMaxLogLevel), xx, ##__VA_ARGS__) |
#define | NIDWARNING(xx,...) |
#define | NIDINFO(xx,...) NIDCONDITIONLOG((NILOGLEVEL_INFO <= NIMaxLogLevel), xx, ##__VA_ARGS__) |
Functions | |
int | NIIsInDebugger (void) |
Variables | |
NSInteger | NIMaxLogLevel |
BOOL | NIDebugAssertionsShouldBreak |
For inspecting code and writing to logs in debug builds.
Nearly all of the following macros will only do anything if the DEBUG macro is defined. The recommended way to enable the debug tools is to specify DEBUG in the "Preprocessor Macros" field in your application's Debug target settings. Be careful not to set this for your release or app store builds because this will enable code that may cause your app to be rejected.
Debug assertions are a lightweight "sanity check". They won't crash the app, nor will they be included in release builds. They will halt the app's execution when debugging so that you can inspect the values that caused the failure.
If statement is false, the statement will be written to the log and if a debugger is attached, the app will break on the assertion line.
Print the given formatted text to the log.
Print the current method name to the log.
If statement is true, then the formatted text will be written to the log.
Will only write the formatted text to the log if NIMaxLogLevel is greater than the respective NID* method's log level. See below for log levels.
The default maximum log level is NILOGLEVEL_WARNING.
NIMaxLogLevel is declared a non-const extern so that you can modify it at runtime. This can be helpful for turning logging on while the application is running.
Only writes to the log when DEBUG is defined.
This log method will always write to the log, regardless of log levels. It is used by all of the other logging methods in Nimbus' debugging library.
Write the containing method's name to the log using NIDPRINT.
Only writes to the log if condition is satisified.
This macro powers the level-based loggers. It can also be used for conditionally enabling families of logs.
Only writes to the log if NIMaxLogLevel >= NILOGLEVEL_ERROR.
Only writes to the log if NIMaxLogLevel >= NILOGLEVEL_WARNING.
Only writes to the log if NIMaxLogLevel >= NILOGLEVEL_INFO.
Assertions that only fire when DEBUG is defined.
An assertion is like a programmatic breakpoint. Use it for sanity checks to save headache while writing your code.
The maximum log level to output for Nimbus debug logs.
This value may be changed at run-time.
The default value is NILOGLEVEL_WARNING.
Whether or not debug assertions should halt program execution like a breakpoint when they fail.
An example of when this is used is in unit tests, when failure cases are tested that will fire debug assertions.
The default value is YES.