1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| + (void)setup { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *libraryDirectory = [paths firstObject]; #if DEBUG xlogger_SetLevel(kLevelDebug); mars::xlog::appender_set_console_log(true); #else xlogger_SetLevel(kLevelInfo); appender_set_console_log(false); #endif mars::xlog::XLogConfig config; config.mode_ = mars::xlog::kAppenderAsync; config.logdir_ = [[libraryDirectory stringByAppendingString:@"/log/"] UTF8String]; NSLog(@"dir = %s", config.logdir_.c_str()); config.nameprefix_ = "Test"; config.pub_key_ = ""; config.compress_mode_ = mars::xlog::kZlib; config.compress_level_ = 0; config.cachedir_ = ""; config.cache_days_ = 0; appender_open(config); }
|