I recognize ddLogLevel
as the log level for the log system cocoalumberjack. Instead “overriding” for your class (no such thing since it is a global variable), you should do what they call Fine Grained Logging. That is, define a log with using the next bit in the bitmask, then set the global constant to a bitwise combination of masks that includes or excludes your flag. It's further explained on the linked page. Example:
Add these defines
#define LOG_FLAG_FOOD_TIMER (1 << 4) // 0...0010000
#define LOG_FOOD_TIMER (ddLogLevel & LOG_FLAG_FOOD_TIMER)
#define DDLogFoodTimer(frmt, ...) ASYNC_LOG_OBJC_MAYBE(ddLogLevel, LOG_FLAG_FOOD_TIMER, 0, frmt, ##__VA_ARGS__)
then in your class use this macro as the log statement:
DDLogFoodTimer(@"blah");
and set the global as:
static const int ddLogLevel = LOG_LEVEL_WARN | LOG_FLAG_FOOD_TIMER;
In C and Objective-C the const keyword creates a read only variable. The keyword const applies applies to whatever is immediately to its left. If there is nothing to its left, it applies to whatever is immediately to its right. Example:
// a modifiable pointer to a constant integer (its value can't be modified).
const int * i;
// Constant pointer to constant integer.
const int const * i;
extern is an indication that a variable is defined elsewhere. It's common style to define global variables like this:
// header file (outside the class definition)
extern NSString* PREFS_MY_CONSTANT;
// implementation file (outside the class definition)
NSString* PREFS_MY_CONSTANT = @"prefs_my_constant";