I\'m using CocoaLumberjack in an iPhone project, to log some information.
I\'ve followed the Getting started guide, and everything works fine, but there is one thing
You do not need the now deprecated .pch file, simply include a header file where needed.
#ifndef Project_Logger_h
#define Project_Logger_h
#if defined(__OBJC__)
#import
extern int ddLogLevel;
#endif
#endif
#import "Logger.h"
int ddLogLevel = LOG_LEVEL_VERBOSE;
#import
int ddLogLevel = DDLogLevelVerbose;
If the syntax changes when 2.0 is out of beta please comment or edit.
#import "AppDelegate.h"
#import "Logger.h"
#import
#import
#import
@interface AppDelegate ()
@property (strong, nonatomic) DDFileLogger *fileLogger;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[DDLog addLogger:[DDASLLogger sharedInstance]];
[DDLog addLogger:[DDTTYLogger sharedInstance]];
DDFileLogger *fileLogger = [[DDFileLogger alloc] init];
fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
fileLogger.logFileManager.maximumNumberOfLogFiles = 7;
[DDLog addLogger:fileLogger];
self.fileLogger = fileLogger;
DDLogDebug(@"%s", __PRETTY_FUNCTION__);
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
DDLogDebug(@"%s", __PRETTY_FUNCTION__);
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
DDLogDebug(@"%s", __PRETTY_FUNCTION__);
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
DDLogDebug(@"%s", __PRETTY_FUNCTION__);
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
DDLogDebug(@"%s", __PRETTY_FUNCTION__);
}
- (void)applicationWillTerminate:(UIApplication *)application
{
DDLogDebug(@"%s", __PRETTY_FUNCTION__);
}