You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.7 KiB

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