mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-12-23 12:55:29 +00:00
Keep a log of uploaded crash IDs on the Mac. Review URL: http://breakpad.appspot.com/245001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@748 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
c45b12b422
commit
717bf0ded2
|
@ -50,10 +50,13 @@ extern "C" {
|
|||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// Keys for configuration file
|
||||
// Keys for configuration file
|
||||
#define kReporterMinidumpDirectoryKey "MinidumpDir"
|
||||
#define kReporterMinidumpIDKey "MinidumpID"
|
||||
|
||||
// Filename for recording uploaded IDs
|
||||
#define kReporterLogFilename "uploads.log"
|
||||
|
||||
// The default subdirectory of the Library to put crash dumps in
|
||||
// The subdirectory is
|
||||
// ~/Library/<kDefaultLibrarySubdirectory>/<GoogleBreakpadProduct>
|
||||
|
|
|
@ -255,6 +255,9 @@ NSString *const kDefaultServerType = @"google";
|
|||
// in their comments/email.
|
||||
- (void)controlTextDidBeginEditing:(NSNotification *)aNotification;
|
||||
|
||||
// Records the uploaded crash ID to the log file.
|
||||
- (void)logUploadWithID:(const char *)uploadID;
|
||||
|
||||
@end
|
||||
|
||||
@implementation Reporter
|
||||
|
@ -992,6 +995,7 @@ doCommandBySelector:(SEL)commandSelector {
|
|||
} else {
|
||||
NSCharacterSet *trimSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
reportID = [[result stringByTrimmingCharactersInSet:trimSet] UTF8String];
|
||||
[self logUploadWithID:reportID];
|
||||
}
|
||||
|
||||
// rename the minidump file according to the id returned from the server
|
||||
|
@ -1036,6 +1040,29 @@ doCommandBySelector:(SEL)commandSelector {
|
|||
[upload release];
|
||||
}
|
||||
|
||||
- (void)logUploadWithID:(const char *)uploadID {
|
||||
NSString *minidumpDir =
|
||||
[parameters_ objectForKey:@kReporterMinidumpDirectoryKey];
|
||||
NSString *logFilePath = [NSString stringWithFormat:@"%@/%s",
|
||||
minidumpDir, kReporterLogFilename];
|
||||
NSString *logLine = [NSString stringWithFormat:@"%0.f,%s\n",
|
||||
[[NSDate date] timeIntervalSince1970], uploadID];
|
||||
NSData *logData = [logLine dataUsingEncoding:kCFStringEncodingUTF8];
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
if ([fileManager fileExistsAtPath:logFilePath]) {
|
||||
NSFileHandle *logFileHandle =
|
||||
[NSFileHandle fileHandleForWritingAtPath:logFilePath];
|
||||
[logFileHandle seekToEndOfFile];
|
||||
[logFileHandle writeData:logData];
|
||||
[logFileHandle closeFile];
|
||||
} else {
|
||||
[fileManager createFileAtPath:logFilePath
|
||||
contents:logData
|
||||
attributes:nil];
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
- (void)dealloc {
|
||||
[parameters_ release];
|
||||
|
|
Loading…
Reference in a new issue