I'm looking for the Swift equivalent of the following Objective C common code. In Objective C we had the following to redirect logging to the document folder instead of to the console:
- (void) redirectConsoleLogToDocumentFolder
{
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,
YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *logPath = [documentsDirectory
stringByAppendingPathComponent:@"console.log"];
freopen([logPath
cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr);
}
How is that done in Swift 2 ?