2 * Copyright 2017 Google
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #import "FIRMMessageCode.h"
19 // The convenience macros are only defined if they haven't already been defined.
20 #ifndef FIRMessagingLoggerInfo
22 // Convenience macros that log to the shared FIRMessagingLogger instance. These macros
23 // are how users should typically log to FIRMessagingLogger.
24 #define FIRMessagingLoggerDebug(code, ...) \
25 [FIRMessagingSharedLogger() logFuncDebug:__func__ messageCode:code msg:__VA_ARGS__]
26 #define FIRMessagingLoggerInfo(code, ...) \
27 [FIRMessagingSharedLogger() logFuncInfo:__func__ messageCode:code msg:__VA_ARGS__]
28 #define FIRMessagingLoggerNotice(code, ...) \
29 [FIRMessagingSharedLogger() logFuncNotice:__func__ messageCode:code msg:__VA_ARGS__]
30 #define FIRMessagingLoggerWarn(code, ...) \
31 [FIRMessagingSharedLogger() logFuncWarning:__func__ messageCode:code msg:__VA_ARGS__]
32 #define FIRMessagingLoggerError(code, ...) \
33 [FIRMessagingSharedLogger() logFuncError:__func__ messageCode:code msg:__VA_ARGS__]
35 #endif // !defined(FIRMessagingLoggerInfo)
37 @interface FIRMessagingLogger : NSObject
39 - (void)logFuncDebug:(const char *)func
40 messageCode:(FIRMessagingMessageCode)messageCode
41 msg:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3, 4);
43 - (void)logFuncInfo:(const char *)func
44 messageCode:(FIRMessagingMessageCode)messageCode
45 msg:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3, 4);
47 - (void)logFuncNotice:(const char *)func
48 messageCode:(FIRMessagingMessageCode)messageCode
49 msg:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3, 4);
51 - (void)logFuncWarning:(const char *)func
52 messageCode:(FIRMessagingMessageCode)messageCode
53 msg:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3, 4);
55 - (void)logFuncError:(const char *)func
56 messageCode:(FIRMessagingMessageCode)messageCode
57 msg:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3, 4);
62 * Instantiates and/or returns a shared FIRMessagingLogger used exclusively
63 * for FIRMessaging log messages.
65 * @return the shared FIRMessagingLogger instance
67 FIRMessagingLogger *FIRMessagingSharedLogger(void);