I'm trying to add custom logging to my objc application. Currently it uses CocoaLumberjack. But I also want the logs to be sent to Crashlytics in case of app crash. So I created a new header file with macroses, which looks basically like this:
#import <CocoaLumberjack/CocoaLumberjack.h>
#import <Crashlytics/Crashlytics.h>
#ifdef DEBUG
static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
#else
static const DDLogLevel ddLogLevel = DDLogLevelWarning;
#endif
#define BKLogVerbose(frmt,...) DDLogVerbose(frmt, ##__VA_ARGS__)
#define BKLogDebug(frmt,...) DDLogVerbose(frmt, ##__VA_ARGS__)
#define BKLogInfo(frmt,...) DDLogInfo(frmt, ##__VA_ARGS__);\
CLS_LOG(frmt, ##__VA_ARGS__)
#define BKLogWarn(frmt,...) DDLogWarn(frmt, ##__VA_ARGS__);\
CLS_LOG(frmt, ##__VA_ARGS__)
#define BKLogError(frmt,...) DDLogError(frmt, ##__VA_ARGS__);\
CLS_LOG(frmt, ##__VA_ARGS__)
Than I'm importing this file where I need extended logging:
#import "BKLogging.h"
...
BKLogError(@"%s, error: %@", __PRETTY_FUNCTION__, error);
But when I try using it I get:
Implicit declaration of function 'DDLogError' is invalid in C99
I understand that compiler cannot find DDLogError function declaration, but I don't know how to fix it (I guess I need to import Crashlytics and CocoaLumberjack to every single file where BKLogging is used, but I'm wondering for better solution).