-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[App Check] Add log filtering based on log level (#11570)
Updated the logging functions in App Check to support filtering out messages based on log levels. Implementation is based on GDTCORConsoleLogger.
- Loading branch information
1 parent
ec898f3
commit 41c3bfd
Showing
13 changed files
with
153 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2020 Google LLC | ||
* | ||
* 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 <Foundation/Foundation.h> | ||
|
||
#import "AppCheck/Sources/Public/AppCheck/GACAppCheckErrors.h" | ||
#import "AppCheck/Sources/Public/AppCheck/GACAppCheckLogger.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** Prints the given code and message to the console. | ||
* | ||
* @param code The message code describing the nature of the log. | ||
* @param logLevel The log level of this log. | ||
* @param message The message string to log. | ||
*/ | ||
FOUNDATION_EXPORT | ||
void GACAppCheckLog(GACAppCheckMessageCode code, | ||
GACAppCheckLogLevel logLevel, | ||
NSString *_Nonnull message); | ||
|
||
#define GACAppCheckLogFault(MESSAGE_CODE, MESSAGE) \ | ||
GACAppCheckLog(MESSAGE_CODE, GACAppCheckLogLevelFault, MESSAGE); | ||
|
||
#define GACAppCheckLogError(MESSAGE_CODE, MESSAGE) \ | ||
GACAppCheckLog(MESSAGE_CODE, GACAppCheckLogLevelError, MESSAGE); | ||
|
||
#define GACAppCheckLogWarning(MESSAGE_CODE, MESSAGE) \ | ||
GACAppCheckLog(MESSAGE_CODE, GACAppCheckLogLevelWarning, MESSAGE); | ||
|
||
#define GACAppCheckLogInfo(MESSAGE_CODE, MESSAGE) \ | ||
GACAppCheckLog(MESSAGE_CODE, GACAppCheckLogLevelInfo, MESSAGE); | ||
|
||
#define GACAppCheckLogDebug(MESSAGE_CODE, MESSAGE) \ | ||
GACAppCheckLog(MESSAGE_CODE, GACAppCheckLogLevelDebug, MESSAGE); | ||
|
||
NS_ASSUME_NONNULL_END |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* 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 "GACAppCheckErrors.h" | ||
|
||
/// The current logging level. | ||
/// | ||
/// Messages with levels equal to or higher priority than `GACAppCheckLogLevel` will be printed, | ||
/// where Fault > Error > Warning > Info > Debug. | ||
/// | ||
/// Note: Declared as volatile to make getting and setting atomic. | ||
FOUNDATION_EXPORT volatile NSInteger gGACAppCheckLogLevel; | ||
|
||
/// Constants that specify the level of logging to perform in App Check Core. | ||
typedef NS_ENUM(NSInteger, GACAppCheckLogLevel) { | ||
/// The debug log level; equivalent to `OS_LOG_TYPE_DEBUG`. | ||
GACAppCheckLogLevelDebug = 1, | ||
/// The informational log level; equivalent to `OS_LOG_TYPE_INFO`. | ||
GACAppCheckLogLevelInfo = 2, | ||
/// The warning log level; equivalent to `OS_LOG_TYPE_DEFAULT`. | ||
GACAppCheckLogLevelWarning = 3, | ||
/// The error log level; equivalent to `OS_LOG_TYPE_ERROR`. | ||
GACAppCheckLogLevelError = 4, | ||
/// The fault log level; equivalent to `OS_LOG_TYPE_FAULT`. | ||
GACAppCheckLogLevelFault = 5 | ||
} NS_SWIFT_NAME(AppCheckCoreLogLevel); |