GDTCORConsoleLogger.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright 2018 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 <Foundation/Foundation.h>
  17. /** A list of message codes to print in the logger that help to correspond printed messages with
  18. * code locations.
  19. *
  20. * Prefixes:
  21. * - MCW => MessageCodeWarning
  22. * - MCE => MessageCodeError
  23. */
  24. typedef NS_ENUM(NSInteger, GDTCORMessageCode) {
  25. /** For warning messages concerning transportBytes: not being implemented by a data object. */
  26. GDTCORMCWDataObjectMissingBytesImpl = 1,
  27. /** For warning messages concerning a failed event upload. */
  28. GDTCORMCWUploadFailed = 2,
  29. /** For warning messages concerning a forced event upload. */
  30. GDTCORMCWForcedUpload = 3,
  31. /** For warning messages concerning a failed reachability call. */
  32. GDTCORMCWReachabilityFailed = 4,
  33. /** For error messages concerning transform: not being implemented by an event transformer. */
  34. GDTCORMCETransformerDoesntImplementTransform = 1000,
  35. /** For error messages concerning the creation of a directory failing. */
  36. GDTCORMCEDirectoryCreationError = 1001,
  37. /** For error messages concerning the writing of a event file. */
  38. GDTCORMCEFileWriteError = 1002,
  39. /** For error messages concerning the lack of a prioritizer for a given backend. */
  40. GDTCORMCEPrioritizerError = 1003,
  41. /** For error messages concerning a package delivery API violation. */
  42. GDTCORMCEDeliverTwice = 1004,
  43. /** For error messages concerning an error in an implementation of -transportBytes. */
  44. GDTCORMCETransportBytesError = 1005,
  45. /** For general purpose error messages in a dependency. */
  46. GDTCORMCEGeneralError = 1006,
  47. /** For fatal errors. Please go to https://github.com/firebase/firebase-ios-sdk/issues and open
  48. * an issue if you encounter an error with this code.
  49. */
  50. GDTCORMCEFatalAssertion = 1007
  51. };
  52. /** */
  53. FOUNDATION_EXPORT
  54. void GDTCORLog(GDTCORMessageCode code, NSString *_Nonnull format, ...);
  55. /** Returns the string that represents some message code.
  56. *
  57. * @param code The code to convert to a string.
  58. * @return The string representing the message code.
  59. */
  60. FOUNDATION_EXPORT NSString *_Nonnull GDTCORMessageCodeEnumToString(GDTCORMessageCode code);
  61. // A define to wrap GULLogWarning with slightly more convenient usage.
  62. #define GDTCORLogWarning(MESSAGE_CODE, MESSAGE_FORMAT, ...) \
  63. GDTCORLog(MESSAGE_CODE, MESSAGE_FORMAT, __VA_ARGS__);
  64. // A define to wrap GULLogError with slightly more convenient usage and a failing assert.
  65. #define GDTCORLogError(MESSAGE_CODE, MESSAGE_FORMAT, ...) \
  66. GDTCORLog(MESSAGE_CODE, MESSAGE_FORMAT, __VA_ARGS__);