| | |
| | | |
| | | /** |
| | | * The services used in the logger. |
| | | * |
| | | * DEPRECATED; use NSString instead. |
| | | */ |
| | | typedef NSString *const GULLoggerService; |
| | | |
| | |
| | | extern "C" { |
| | | #endif // __cplusplus |
| | | |
| | | /** |
| | | * Initialize GULLogger. |
| | | */ |
| | | extern void GULLoggerInitializeASL(void); |
| | | /// Used for other GoogleUtilities logging. |
| | | extern NSString *const kGULLogSubsystem; |
| | | |
| | | /** |
| | | * Override log level to Debug. |
| | | */ |
| | | /// Initialize GULLogger. |
| | | extern void GULLoggerInitialize(void); |
| | | |
| | | /// Override log level to Debug. |
| | | void GULLoggerForceDebug(void); |
| | | |
| | | /** |
| | | * Turn on logging to STDERR. |
| | | */ |
| | | extern void GULLoggerEnableSTDERR(void); |
| | | |
| | | /** |
| | | * Gets the current GULLoggerLevel. |
| | | */ |
| | | /// Gets the current `GULLoggerLevel`. |
| | | extern GULLoggerLevel GULGetLoggerLevel(void); |
| | | |
| | | /** |
| | |
| | | * (optional) variable arguments list obtained from calling va_start, used when message is a format |
| | | * string. |
| | | */ |
| | | extern void GULLogBasic(GULLoggerLevel level, |
| | | GULLoggerService service, |
| | | BOOL forceLog, |
| | | NSString *messageCode, |
| | | NSString *message, |
| | | extern void GULOSLogBasic(GULLoggerLevel level, |
| | | NSString *subsystem, |
| | | NSString *category, |
| | | BOOL forceLog, |
| | | NSString *messageCode, |
| | | NSString *message, |
| | | // On 64-bit simulators, va_list is not a pointer, so cannot be marked nullable |
| | | // See: http://stackoverflow.com/q/29095469 |
| | | #if __LP64__ && TARGET_OS_SIMULATOR || TARGET_OS_OSX |
| | | va_list args_ptr |
| | | va_list args_ptr |
| | | #else |
| | | va_list _Nullable args_ptr |
| | | va_list _Nullable args_ptr |
| | | #endif |
| | | ); |
| | | |
| | |
| | | * Example usage: |
| | | * GULLogError(kGULLoggerCore, @"I-COR000001", @"Configuration of %@ failed.", app.name); |
| | | */ |
| | | extern void GULLogError(GULLoggerService service, |
| | | BOOL force, |
| | | NSString *messageCode, |
| | | NSString *message, |
| | | ...) NS_FORMAT_FUNCTION(4, 5); |
| | | extern void GULLogWarning(GULLoggerService service, |
| | | extern void GULOSLogError(NSString *subsystem, |
| | | GULLoggerService category, |
| | | BOOL force, |
| | | NSString *messageCode, |
| | | NSString *message, |
| | | ...) NS_FORMAT_FUNCTION(4, 5); |
| | | extern void GULLogNotice(GULLoggerService service, |
| | | ...) NS_FORMAT_FUNCTION(5, 6); |
| | | extern void GULOSLogWarning(NSString *subsystem, |
| | | GULLoggerService category, |
| | | BOOL force, |
| | | NSString *messageCode, |
| | | NSString *message, |
| | | ...) NS_FORMAT_FUNCTION(5, 6); |
| | | extern void GULOSLogNotice(NSString *subsystem, |
| | | GULLoggerService category, |
| | | BOOL force, |
| | | NSString *messageCode, |
| | | NSString *message, |
| | | ...) NS_FORMAT_FUNCTION(5, 6); |
| | | extern void GULOSLogInfo(NSString *subsystem, |
| | | GULLoggerService category, |
| | | BOOL force, |
| | | NSString *messageCode, |
| | | NSString *message, |
| | | ...) NS_FORMAT_FUNCTION(4, 5); |
| | | extern void GULLogInfo(GULLoggerService service, |
| | | BOOL force, |
| | | NSString *messageCode, |
| | | NSString *message, |
| | | ...) NS_FORMAT_FUNCTION(4, 5); |
| | | extern void GULLogDebug(GULLoggerService service, |
| | | BOOL force, |
| | | NSString *messageCode, |
| | | NSString *message, |
| | | ...) NS_FORMAT_FUNCTION(4, 5); |
| | | ...) NS_FORMAT_FUNCTION(5, 6); |
| | | extern void GULOSLogDebug(NSString *subsystem, |
| | | GULLoggerService category, |
| | | BOOL force, |
| | | NSString *messageCode, |
| | | NSString *message, |
| | | ...) NS_FORMAT_FUNCTION(5, 6); |
| | | |
| | | #ifdef __cplusplus |
| | | } // extern "C" |
| | |
| | | |
| | | @interface GULLoggerWrapper : NSObject |
| | | |
| | | /** |
| | | * Objective-C wrapper for GULLogBasic to allow weak linking to GULLogger |
| | | * (required) log level (one of the GULLoggerLevel enum values). |
| | | * (required) service name of type GULLoggerService. |
| | | * (required) message code starting with "I-" which means iOS, followed by a capitalized |
| | | * three-character service identifier and a six digit integer message ID that is unique |
| | | * within the service. |
| | | * An example of the message code is @"I-COR000001". |
| | | * (required) message string which can be a format string. |
| | | * (optional) variable arguments list obtained from calling va_start, used when message is a format |
| | | * string. |
| | | */ |
| | | |
| | | /// Objective-C wrapper for `GULOSLogBasic` to allow weak linking to `GULLogger`. |
| | | /// |
| | | /// - Parameters: |
| | | /// - level: The log level (one of the `GULLoggerLevel` enum values). |
| | | /// - subsystem: An identifier for the subsystem performing logging, e.g., `com.example.logger`. |
| | | /// - category: The category name within the `subsystem` to group related messages, e.g., |
| | | /// `[GoogleUtilities/Example]`. |
| | | /// - messageCode: The message code starting with "I-" which means iOS, followed by a capitalized |
| | | /// three-character service identifier and a six digit integer message ID that is unique within |
| | | /// the service. An example of the message code is @"I-COR000001". |
| | | /// - message: The message to log, which may be a format string. |
| | | /// - arguments: The variable arguments list obtained from calling va_start, used when message is |
| | | /// a format string; optional if `message` is not a format string. |
| | | + (void)logWithLevel:(GULLoggerLevel)level |
| | | withService:(GULLoggerService)service |
| | | withCode:(NSString *)messageCode |
| | | withMessage:(NSString *)message |
| | | withArgs:(va_list)args; |
| | | subsystem:(NSString *)subsystem |
| | | category:(NSString *)category |
| | | messageCode:(NSString *)messageCode |
| | | message:(NSString *)message |
| | | arguments:(va_list)args; |
| | | |
| | | @end |
| | | |