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>
diff --git a/src/client/mac/sender/uploader.mm b/src/client/mac/sender/uploader.mm
index 08aecf7..13b6130 100644
--- a/src/client/mac/sender/uploader.mm
+++ b/src/client/mac/sender/uploader.mm
@@ -28,6 +28,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import <fcntl.h>
+#include <stdio.h>
#import <sys/stat.h>
#include <TargetConditionals.h>
#import <unistd.h>
@@ -38,7 +39,6 @@
#import "client/apple/Framework/BreakpadDefines.h"
#import "client/mac/sender/uploader.h"
-#import "common/mac/GTMLogger.h"
const int kMinidumpFileLengthLimit = 2 * 1024 * 1024; // 2MB
@@ -89,17 +89,15 @@
NSDictionary *readConfigurationData(const char *configFile) {
int fileId = open(configFile, O_RDONLY, 0600);
if (fileId == -1) {
- GTMLoggerDebug(@"Couldn't open config file %s - %s",
- configFile,
- strerror(errno));
+ fprintf(stderr, "Breakpad Uploader: Couldn't open config file %s - %s",
+ configFile, strerror(errno));
}
// we want to avoid a build-up of old config files even if they
// have been incorrectly written by the framework
if (unlink(configFile)) {
- GTMLoggerDebug(@"Couldn't unlink config file %s - %s",
- configFile,
- strerror(errno));
+ fprintf(stderr, "Breakpad Uploader: Couldn't unlink config file %s - %s",
+ configFile, strerror(errno));
}
if (fileId == -1) {
@@ -360,7 +358,8 @@
NSString *logTarFile = [NSString stringWithFormat:@"%s/log.tar.bz2",tmpDir];
logFileData_ = [[NSData alloc] initWithContentsOfFile:logTarFile];
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 YES;
@@ -529,13 +528,14 @@
const char *dest = [destString fileSystemRepresentation];
if (rename(src, dest) == 0) {
- GTMLoggerInfo(@"Breakpad Uploader: Renamed %s to %s after successful " \
- "upload",src, dest);
+ fprintf(stderr,
+ "Breakpad Uploader: Renamed %s to %s after successful upload", src,
+ dest);
}
else {
// can't rename - don't worry - it's not important for users
- GTMLoggerDebug(@"Breakpad Uploader: successful upload report ID = %s\n",
- reportID );
+ fprintf(stderr, "Breakpad Uploader: successful upload report ID = %s\n",
+ reportID);
}
[result release];
}