Skip to content

Commit

Permalink
DEBUG: file logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tmolitor-stud-tu committed Jan 3, 2025
1 parent a6a87d0 commit 4b68edc
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions Monal/Classes/HelperTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -2220,6 +2220,8 @@ +(void) configureXcodeLogging

+(void) configureLogging
{
NSError* error;

//network logger (start as early as possible)
MLUDPLogger* udpLogger = [MLUDPLogger new];
[DDLog addLogger:udpLogger];
Expand All @@ -2233,10 +2235,17 @@ +(void) configureLogging
printf("stdout redirection complete...");

//redirect apple system logs, too
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[DDASLLogCapture start];
#pragma clang diagnostic pop
/*
OSLogStore* osLogStore = [OSLogStore storeWithScope:OSLogStoreCurrentProcessIdentifier error:&error];
if(error)
DDLogError(@"Failed to open os log store: %@", error);
else
{
dispatch_async(, ^{
[osLogStore entriesEnumeratorAndReturnError:&error];
});
}
*/

NSString* containerUrl = [[HelperTools getContainerURLForPathComponents:@[]] path];
DDLogInfo(@"Logfile dir: %@", containerUrl);
Expand All @@ -2253,7 +2262,6 @@ +(void) configureLogging

DDLogDebug(@"Sorted logfiles: %@", [logFileManager sortedLogFileInfos]);
DDLogDebug(@"Current logfile: %@", self.fileLogger.currentLogFileInfo.filePath);
NSError* error;
NSDictionary* attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:self.fileLogger.currentLogFileInfo.filePath error:&error];
if(error)
DDLogError(@"File attributes error: %@", error);
Expand Down Expand Up @@ -2281,6 +2289,12 @@ +(void) configureLogging
NSArray* directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:containerUrl error:nil];
for(NSString* file in directoryContents)
DDLogVerbose(@"File %@/%@", containerUrl, file);

NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsUrl = [[paths objectAtIndex:0] stringByAppendingPathComponent:@".."];
directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsUrl error:nil];
for(NSString* file in directoryContents)
DDLogVerbose(@"File %@/%@", documentsUrl, file);
}

+(int) pendingCrashreportCount
Expand Down

0 comments on commit 4b68edc

Please sign in to comment.