CocoaLumberjack

static constint ddLogLevel =DDLogLevelWarning;


-(void)setUpLumberJack

{

    NSArray  *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);

    NSString *docPath = [[pathslastObject]stringByAppendingString:@"/Logs"];

    DDLogFileManagerDefault* fileManager = [[DDLogFileManagerDefaultalloc]initWithLogsDirectory:docPathdefaultFileProtectionLevel:NSFileProtectionNone];

    DDFileLogger* fileLogger = [[DDFileLoggeralloc]initWithLogFileManager:fileManager];

    

    [DDLogaddLogger:[DDASLLoggersharedInstance]];

    [DDLogaddLogger:[DDTTYLoggersharedInstance]];

    [DDLogaddLogger:fileLogger];

}

原文地址:https://www.cnblogs.com/yangykaifa/p/7255715.html