Logging
In order to provide fast and flexible logging, SDK uses Cocoa Lumberjack.
There are the 4 log levels:
- Error
- Warning
- Info
- Verbose
In addition to this, there is a Trace flag that can be enabled. When tracing is enabled, it spits out the methods that are being called. Tracing is separate from the log levels. For example, one could set the log level to warning, and enable tracing.
All logging is asynchronous, except errors. To use logging within your own custom files, follow the steps below.
- Import IrisLogging header in the implementation file.
import "IrisLogging.h"
- Define logging level in the implementation file.
Log levels: off, error, warn, info, verbose
To enable tracing,static const int irisLogLevel = IRIS_LOG_LEVEL_VERBOSE;
static const int irisLogLevel = IRIS_LOG_LEVEL_INFO | IRIS_LOG_FLAG_TRACE;
- Replace NSLog statements with IRISLog statements according to the severity of the message.
IRISLog has the same syntax as NSLog. This means you can pass multiple variables to it, just like NSLog. You may optionally choose to define different log levels for debug and release builds.NSLog(@"Fatal error, no key found!"); -> IRISLogError(@"Fatal error, no key found!");
Xcode projects created with Xcode 4 automatically define DEBUG via the project's preprocessor macros. If the project is created with previous versions of Xcode, you may need to add the DEBUG macro manually.#if DEBUG static const int irisLogLevel = IRIS_LOG_LEVEL_VERBOSE; #else static const int irisLogLevel = IRIS_LOG_LEVEL_WARN; #endif