I am using CocoaLumberjack V2.4 to save log into file.
This is the default code to set saving log into file:
DDFileLogger *fileLogger = [[DDFileLogger alloc] init]; // File Logger
fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
fileLogger.logFileManager.maximumNumberOfLogFiles = 7;
[DDLog addLogger:fileLogger];
Log is saved in default place: /AppData/Library/Caches/Logs/
I want implement an API to remove the saved log manually. I check they have Manually clear logs as the open issue there. Anyone has suggestion?
This should work for you:
[fileLogger rollLogFileWithCompletionBlock: ^{
for (NSString *filename in fileLogger.logFileManager.sortedLogFilePaths) {
[[NSFileManager defaultManager] removeItemAtPath:filename error:nil];
}
}];