Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
/*
2
 * Copyright 2017 Google
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
 
17
#import <Foundation/Foundation.h>
18
 
19
#import <FirebaseCore/FIRLoggerLevel.h>
20
 
21
NS_ASSUME_NONNULL_BEGIN
22
 
23
/**
24
 * The Firebase services used in Firebase logger.
25
 */
26
typedef NSString *const FIRLoggerService;
27
 
28
extern FIRLoggerService kFIRLoggerAnalytics;
29
extern FIRLoggerService kFIRLoggerCrash;
30
extern FIRLoggerService kFIRLoggerCore;
31
extern FIRLoggerService kFIRLoggerRemoteConfig;
32
 
33
/**
34
 * The key used to store the logger's error count.
35
 */
36
extern NSString *const kFIRLoggerErrorCountKey;
37
 
38
/**
39
 * The key used to store the logger's warning count.
40
 */
41
extern NSString *const kFIRLoggerWarningCountKey;
42
 
43
#ifdef __cplusplus
44
extern "C" {
45
#endif  // __cplusplus
46
 
47
/**
48
 * Enables or disables Analytics debug mode.
49
 * If set to true, the logging level for Analytics will be set to FirebaseLoggerLevelDebug.
50
 * Enabling the debug mode has no effect if the app is running from App Store.
51
 * (required) analytics debug mode flag.
52
 */
53
void FIRSetAnalyticsDebugMode(BOOL analyticsDebugMode);
54
 
55
/**
56
 * Changes the default logging level of FirebaseLoggerLevelNotice to a user-specified level.
57
 * The default level cannot be set above FirebaseLoggerLevelNotice if the app is running from App
58
 * Store. (required) log level (one of the FirebaseLoggerLevel enum values).
59
 */
60
void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel);
61
 
62
/**
63
 * Checks if the specified logger level is loggable given the current settings.
64
 * (required) log level (one of the FirebaseLoggerLevel enum values).
65
 * (required) whether or not this function is called from the Analytics component.
66
 */
67
BOOL FIRIsLoggableLevel(FIRLoggerLevel loggerLevel, BOOL analyticsComponent);
68
 
69
/**
70
 * Logs a message to the Xcode console and the device log. If running from AppStore, will
71
 * not log any messages with a level higher than FirebaseLoggerLevelNotice to avoid log spamming.
72
 * (required) log level (one of the FirebaseLoggerLevel enum values).
73
 * (required) service name of type FirebaseLoggerService.
74
 * (required) message code starting with "I-" which means iOS, followed by a capitalized
75
 *            three-character service identifier and a six digit integer message ID that is unique
76
 *            within the service.
77
 *            An example of the message code is @"I-COR000001".
78
 * (required) message string which can be a format string.
79
 * (optional) variable arguments list obtained from calling va_start, used when message is a format
80
 *            string.
81
 */
82
extern void FIRLogBasic(FIRLoggerLevel level,
83
                        FIRLoggerService service,
84
                        NSString *messageCode,
85
                        NSString *message,
86
// On 64-bit simulators, va_list is not a pointer, so cannot be marked nullable
87
// See: http://stackoverflow.com/q/29095469
88
#if __LP64__ && TARGET_OS_SIMULATOR || TARGET_OS_OSX
89
                        va_list args_ptr
90
#else
91
                        va_list _Nullable args_ptr
92
#endif
93
);
94
 
95
/**
96
 * The following functions accept the following parameters in order:
97
 * (required) service name of type FirebaseLoggerService.
98
 * (required) message code starting from "I-" which means iOS, followed by a capitalized
99
 *            three-character service identifier and a six digit integer message ID that is unique
100
 *            within the service.
101
 *            An example of the message code is @"I-COR000001".
102
 *            See go/firebase-log-proposal for details.
103
 * (required) message string which can be a format string.
104
 * (optional) the list of arguments to substitute into the format string.
105
 * Example usage:
106
 * FirebaseLogError(kFirebaseLoggerCore, @"I-COR000001", @"Configuration of %@ failed.", app.name);
107
 */
108
extern void FIRLogError(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
109
    NS_FORMAT_FUNCTION(3, 4);
110
extern void FIRLogWarning(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
111
    NS_FORMAT_FUNCTION(3, 4);
112
extern void FIRLogNotice(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
113
    NS_FORMAT_FUNCTION(3, 4);
114
extern void FIRLogInfo(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
115
    NS_FORMAT_FUNCTION(3, 4);
116
extern void FIRLogDebug(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
117
    NS_FORMAT_FUNCTION(3, 4);
118
 
119
#ifdef __cplusplus
120
}  // extern "C"
121
#endif  // __cplusplus
122
 
123
@interface FIRLoggerWrapper : NSObject
124
 
125
/**
126
 * Objective-C wrapper for FirebaseLogBasic to allow weak linking to FirebaseLogger
127
 * (required) log level (one of the FirebaseLoggerLevel enum values).
128
 * (required) service name of type FirebaseLoggerService.
129
 * (required) message code starting with "I-" which means iOS, followed by a capitalized
130
 *            three-character service identifier and a six digit integer message ID that is unique
131
 *            within the service.
132
 *            An example of the message code is @"I-COR000001".
133
 * (required) message string which can be a format string.
134
 * (optional) variable arguments list obtained from calling va_start, used when message is a format
135
 *            string.
136
 */
137
 
138
+ (void)logWithLevel:(FIRLoggerLevel)level
139
         withService:(FIRLoggerService)service
140
            withCode:(NSString *)messageCode
141
         withMessage:(NSString *)message
142
            withArgs:(va_list)args;
143
 
144
@end
145
 
146
NS_ASSUME_NONNULL_END