/File-Logger

NSFileManager used log

Primary LanguageObjective-CApache License 2.0Apache-2.0

File-Logger

NSFileManager used log

Usage

AppDelegate.m

NSString *logFilePath = [LogDataPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.log",[NSDate date]]];
freopen([logFilePath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stderr);



#optional
NSError *error;
 NSString *  LogDataPath = [[PRNUtils documentsDirectoryPath]stringByAppendingPathComponent:[NSString             stringWithFormat:@"%@.Logs",@""]];

 if (![[NSFileManager defaultManager] fileExistsAtPath:LogDataPath]){
    [[NSFileManager defaultManager] createDirectoryAtPath:LogDataPath withIntermediateDirectories:NO attributes:nil error:&error]
}