Skip to content

Remove the GULLogger dependency #2703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions GoogleDataTransport.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ Shared library for iOS SDK data transport needs.
s.public_header_files = 'GoogleDataTransport/GoogleDataTransport/Classes/Public/*.h'
s.private_header_files = 'GoogleDataTransport/GoogleDataTransport/Classes/Private/*.h'

s.dependency 'GoogleUtilities/Logger'

s.pod_target_xcconfig = {
'GCC_C_LANGUAGE_STANDARD' => 'c99',
'GCC_TREAT_WARNINGS_AS_ERRORS' => 'YES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@

#import "GDTConsoleLogger.h"

NSString* GDTMessageCodeEnumToString(GDTMessageCode code) {
/** The console logger prefix. */
static NSString *kGDTConsoleLogger = @"[GoogleDataTransport]";

NSString *GDTMessageCodeEnumToString(GDTMessageCode code) {
return [[NSString alloc] initWithFormat:@"I-GDT%06ld", (long)code];
}

void GDTLog(GDTMessageCode code, NSString *format, ...) {
// Don't log anything in not debug builds.
#ifndef NDEBUG
NSString *logFormat = [NSString
stringWithFormat:@"%@[%@] %@", kGDTConsoleLogger, GDTMessageCodeEnumToString(code), format];
va_list args;
va_start(args, format);
NSLogv(logFormat, args);
va_end(args);
#endif // NDEBUG
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@
* limitations under the License.
*/

#import "GULLogger.h"

#import "GDTAssert.h"

/** The console logger prefix. */
static GULLoggerService kGDTConsoleLogger = @"[GoogleDataTransport]";

/** A list of message codes to print in the logger that help to correspond printed messages with
* code locations.
*
Expand Down Expand Up @@ -50,23 +45,21 @@ typedef NS_ENUM(NSInteger, GDTMessageCode) {
};

/** */
FOUNDATION_EXPORT NSString *_Nonnull GDTMessageCodeEnumToString(GDTMessageCode code);
FOUNDATION_EXPORT
void GDTLog(GDTMessageCode code, NSString *format, ...);

/** Logs the warningMessage string to the console at the warning level.
/** Returns the string that represents some message code.
*
* @param warningMessageFormat The format string to log to the console.
* @param code The code to convert to a string.
* @return The string representing the message code.
*/
FOUNDATION_EXPORT void GDTLogWarning(GDTMessageCode messageCode,
NSString *_Nonnull warningMessageFormat,
...) NS_FORMAT_FUNCTION(2, 3);
FOUNDATION_EXPORT NSString *_Nonnull GDTMessageCodeEnumToString(GDTMessageCode code);

// A define to wrap GULLogWarning with slightly more convenient usage.
#define GDTLogWarning(MESSAGE_CODE, MESSAGE_FORMAT, ...) \
GULLogWarning(kGDTConsoleLogger, YES, GDTMessageCodeEnumToString(MESSAGE_CODE), MESSAGE_FORMAT, \
__VA_ARGS__);
#define GDTLogWarning(MESSAGE_CODE, MESSAGE_FORMAT, ...) \
GDTLog(MESSAGE_CODE, MESSAGE_FORMAT, __VA_ARGS__);

// A define to wrap GULLogError with slightly more convenient usage and a failing assert.
#define GDTLogError(MESSAGE_CODE, MESSAGE_FORMAT, ...) \
GULLogError(kGDTConsoleLogger, YES, GDTMessageCodeEnumToString(MESSAGE_CODE), MESSAGE_FORMAT, \
__VA_ARGS__); \
#define GDTLogError(MESSAGE_CODE, MESSAGE_FORMAT, ...) \
GDTLog(MESSAGE_CODE, MESSAGE_FORMAT, __VA_ARGS__); \
GDTAssert(NO, MESSAGE_FORMAT, __VA_ARGS__);