Remove dependency of uploader.mm on GTMLogger
The file GTMLogger shipped with breakpad is a copy of the version from google_toolbox_for_mac. Having uploader.mm depend on GTMLogger causes pain to iOS projects that want to integrate both breakpad and google_toolbox_for_mac. Since the file uploader.mm mixed uses of fprintf and GTMLogger to log errors and warning, convert it to only use fprintf to stderr. Bug: none Change-Id: I68313ccf6951676a2859f44225281813722096ba Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1911755 Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
5915ea929c
commit
792e6b2143
1 changed files with 12 additions and 12 deletions
|
@ -28,6 +28,7 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#import <fcntl.h>
|
#import <fcntl.h>
|
||||||
|
#include <stdio.h>
|
||||||
#import <sys/stat.h>
|
#import <sys/stat.h>
|
||||||
#include <TargetConditionals.h>
|
#include <TargetConditionals.h>
|
||||||
#import <unistd.h>
|
#import <unistd.h>
|
||||||
|
@ -38,7 +39,6 @@
|
||||||
|
|
||||||
#import "client/apple/Framework/BreakpadDefines.h"
|
#import "client/apple/Framework/BreakpadDefines.h"
|
||||||
#import "client/mac/sender/uploader.h"
|
#import "client/mac/sender/uploader.h"
|
||||||
#import "common/mac/GTMLogger.h"
|
|
||||||
|
|
||||||
const int kMinidumpFileLengthLimit = 2 * 1024 * 1024; // 2MB
|
const int kMinidumpFileLengthLimit = 2 * 1024 * 1024; // 2MB
|
||||||
|
|
||||||
|
@ -89,17 +89,15 @@ NSData *readData(int fileId, ssize_t length) {
|
||||||
NSDictionary *readConfigurationData(const char *configFile) {
|
NSDictionary *readConfigurationData(const char *configFile) {
|
||||||
int fileId = open(configFile, O_RDONLY, 0600);
|
int fileId = open(configFile, O_RDONLY, 0600);
|
||||||
if (fileId == -1) {
|
if (fileId == -1) {
|
||||||
GTMLoggerDebug(@"Couldn't open config file %s - %s",
|
fprintf(stderr, "Breakpad Uploader: Couldn't open config file %s - %s",
|
||||||
configFile,
|
configFile, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we want to avoid a build-up of old config files even if they
|
// we want to avoid a build-up of old config files even if they
|
||||||
// have been incorrectly written by the framework
|
// have been incorrectly written by the framework
|
||||||
if (unlink(configFile)) {
|
if (unlink(configFile)) {
|
||||||
GTMLoggerDebug(@"Couldn't unlink config file %s - %s",
|
fprintf(stderr, "Breakpad Uploader: Couldn't unlink config file %s - %s",
|
||||||
configFile,
|
configFile, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileId == -1) {
|
if (fileId == -1) {
|
||||||
|
@ -360,7 +358,8 @@ NSDictionary *readConfigurationData(const char *configFile) {
|
||||||
NSString *logTarFile = [NSString stringWithFormat:@"%s/log.tar.bz2",tmpDir];
|
NSString *logTarFile = [NSString stringWithFormat:@"%s/log.tar.bz2",tmpDir];
|
||||||
logFileData_ = [[NSData alloc] initWithContentsOfFile:logTarFile];
|
logFileData_ = [[NSData alloc] initWithContentsOfFile:logTarFile];
|
||||||
if (logFileData_ == nil) {
|
if (logFileData_ == nil) {
|
||||||
GTMLoggerDebug(@"Cannot find temp tar log file: %@", logTarFile);
|
fprintf(stderr, "Breakpad Uploader: Cannot find temp tar log file: %s",
|
||||||
|
[logTarFile UTF8String]);
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
|
@ -529,13 +528,14 @@ NSDictionary *readConfigurationData(const char *configFile) {
|
||||||
const char *dest = [destString fileSystemRepresentation];
|
const char *dest = [destString fileSystemRepresentation];
|
||||||
|
|
||||||
if (rename(src, dest) == 0) {
|
if (rename(src, dest) == 0) {
|
||||||
GTMLoggerInfo(@"Breakpad Uploader: Renamed %s to %s after successful " \
|
fprintf(stderr,
|
||||||
"upload",src, dest);
|
"Breakpad Uploader: Renamed %s to %s after successful upload", src,
|
||||||
|
dest);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// can't rename - don't worry - it's not important for users
|
// can't rename - don't worry - it's not important for users
|
||||||
GTMLoggerDebug(@"Breakpad Uploader: successful upload report ID = %s\n",
|
fprintf(stderr, "Breakpad Uploader: successful upload report ID = %s\n",
|
||||||
reportID );
|
reportID);
|
||||||
}
|
}
|
||||||
[result release];
|
[result release];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue