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.

64 lines
2.0 KiB

6 years ago
  1. //
  2. // CLSLogging.h
  3. // Crashlytics
  4. //
  5. // Copyright (c) 2015 Crashlytics, Inc. All rights reserved.
  6. //
  7. #ifdef __OBJC__
  8. #import "CLSAttributes.h"
  9. #import <Foundation/Foundation.h>
  10. NS_ASSUME_NONNULL_BEGIN
  11. #endif
  12. /**
  13. *
  14. * The CLS_LOG macro provides as easy way to gather more information in your log messages that are
  15. * sent with your crash data. CLS_LOG prepends your custom log message with the function name and
  16. * line number where the macro was used. If your app was built with the DEBUG preprocessor macro
  17. * defined CLS_LOG uses the CLSNSLog function which forwards your log message to NSLog and CLSLog.
  18. * If the DEBUG preprocessor macro is not defined CLS_LOG uses CLSLog only.
  19. *
  20. * Example output:
  21. * -[AppDelegate login:] line 134 $ login start
  22. *
  23. * If you would like to change this macro, create a new header file, unset our define and then define
  24. * your own version. Make sure this new header file is imported after the Crashlytics header file.
  25. *
  26. * #undef CLS_LOG
  27. * #define CLS_LOG(__FORMAT__, ...) CLSNSLog...
  28. *
  29. **/
  30. #ifdef __OBJC__
  31. #ifdef DEBUG
  32. #define CLS_LOG(__FORMAT__, ...) CLSNSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
  33. #else
  34. #define CLS_LOG(__FORMAT__, ...) CLSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
  35. #endif
  36. #endif
  37. /**
  38. *
  39. * Add logging that will be sent with your crash data. This logging will not show up in the system.log
  40. * and will only be visible in your Crashlytics dashboard.
  41. *
  42. **/
  43. #ifdef __OBJC__
  44. OBJC_EXTERN void CLSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
  45. OBJC_EXTERN void CLSLogv(NSString *format, va_list ap) NS_FORMAT_FUNCTION(1,0);
  46. /**
  47. *
  48. * Add logging that will be sent with your crash data. This logging will show up in the system.log
  49. * and your Crashlytics dashboard. It is not recommended for Release builds.
  50. *
  51. **/
  52. OBJC_EXTERN void CLSNSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
  53. OBJC_EXTERN void CLSNSLogv(NSString *format, va_list ap) NS_FORMAT_FUNCTION(1,0);
  54. NS_ASSUME_NONNULL_END
  55. #endif