-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Create a log wrapper and better test GDLLogWriter #2190
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
Changes from 5 commits
8f438ab
8c17b9b
3aebd2d
319b029
e556712
7711899
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2018 Google | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#import "GULLogger.h" | ||
|
||
/** The console logger prefix. */ | ||
static GULLoggerService kGDLConsoleLogger = @"[GoogleDataLogger]"; | ||
|
||
/** A list of message codes to print in the logger that help to correspond printed messages with | ||
* code locations. */ | ||
typedef NS_ENUM(NSInteger, GDLMessageCode) { | ||
|
||
/** For warning messages concerning transform: not being implemented by a log transformer. */ | ||
GDLMCWTransformerDoesntImplementTransform = 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does MCW stand for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MessageCodeWarning. I'm trying to keep these strings short. Any alternative suggestions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably fine with a comment. |
||
}; | ||
|
||
/** */ | ||
FOUNDATION_EXTERN NSString *GDLMessageCodeEnumToString(GDLMessageCode code); | ||
|
||
/** Logs the warningMessage string to the console at the warning level. | ||
* | ||
* @param warningMessageFormat The format string to log to the console. | ||
*/ | ||
FOUNDATION_EXTERN void GDLLogWarning(GDLMessageCode messageCode, | ||
NSString *warningMessageFormat, | ||
...) NS_FORMAT_FUNCTION(2, 3); | ||
|
||
// A define to wrap GULLogWarning with slightly more convenient usage. | ||
#define GDLLogWarning(MESSAGE_CODE, MESSAGE_FORMAT, ...) \ | ||
GULLogWarning(kGDLConsoleLogger, YES, GDLMessageCodeEnumToString(MESSAGE_CODE), MESSAGE_FORMAT, \ | ||
__VA_ARGS__); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2018 Google | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#import "GDLConsoleLogger.h" | ||
|
||
NSString* GDLMessageCodeEnumToString(GDLMessageCode code) { | ||
return [[NSString alloc] initWithFormat:@"I-GDL%06ld", (long)code]; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.