Nessuna descrizione

AWSDDLegacyMacros.h 3.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Software License Agreement (BSD License)
  2. //
  3. // Copyright (c) 2010-2016, Deusty, LLC
  4. // All rights reserved.
  5. //
  6. // Redistribution and use of this software in source and binary forms,
  7. // with or without modification, are permitted provided that the following conditions are met:
  8. //
  9. // * Redistributions of source code must retain the above copyright notice,
  10. // this list of conditions and the following disclaimer.
  11. //
  12. // * Neither the name of Deusty nor the names of its contributors may be used
  13. // to endorse or promote products derived from this software without specific
  14. // prior written permission of Deusty, LLC.
  15. /**
  16. * Legacy macros used for 1.9.x backwards compatibility.
  17. *
  18. * Imported by default when importing a AWSDDLog.h directly and AWSDD_LEGACY_MACROS is not defined and set to 0.
  19. **/
  20. #if AWSDD_LEGACY_MACROS
  21. #warning CocoaLumberjack 1.9.x legacy macros enabled. \
  22. Disable legacy macros by importing AWSCocoaLumberjack.h or AWSDDLogMacros.h instead of AWSDDLog.h or add `#define AWSDD_LEGACY_MACROS 0` before importing AWSDDLog.h.
  23. #define LOG_FLAG_ERROR AWSDDLogFlagError
  24. #define LOG_FLAG_WARN AWSDDLogFlagWarning
  25. #define LOG_FLAG_INFO AWSDDLogFlagInfo
  26. #define LOG_FLAG_DEBUG AWSDDLogFlagDebug
  27. #define LOG_FLAG_VERBOSE AWSDDLogFlagVerbose
  28. #define LOG_LEVEL_OFF AWSDDLogLevelOff
  29. #define LOG_LEVEL_ERROR AWSDDLogLevelError
  30. #define LOG_LEVEL_WARN AWSDDLogLevelWarning
  31. #define LOG_LEVEL_INFO AWSDDLogLevelInfo
  32. #define LOG_LEVEL_DEBUG AWSDDLogLevelDebug
  33. #define LOG_LEVEL_VERBOSE AWSDDLogLevelVerbose
  34. #define LOG_LEVEL_ALL AWSDDLogLevelAll
  35. #define AWSDD_LOG_ASYNC_ENABLED YES
  36. #define LOG_ASYNC_ERROR ( NO && AWSDD_LOG_ASYNC_ENABLED)
  37. #define LOG_ASYNC_WARN (YES && AWSDD_LOG_ASYNC_ENABLED)
  38. #define LOG_ASYNC_INFO (YES && AWSDD_LOG_ASYNC_ENABLED)
  39. #define LOG_ASYNC_DEBUG (YES && AWSDD_LOG_ASYNC_ENABLED)
  40. #define LOG_ASYNC_VERBOSE (YES && AWSDD_LOG_ASYNC_ENABLED)
  41. #define AWSDD_LOG_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \
  42. [AWSDDLog log : isAsynchronous \
  43. level : lvl \
  44. flag : flg \
  45. context : ctx \
  46. file : __FILE__ \
  47. function : fnct \
  48. line : __LINE__ \
  49. tag : atag \
  50. format : (frmt), ## __VA_ARGS__]
  51. #define AWSDD_LOG_MAYBE(async, lvl, flg, ctx, fnct, frmt, ...) \
  52. do { if(lvl & flg) AWSDD_LOG_MACRO(async, lvl, flg, ctx, nil, fnct, frmt, ##__VA_ARGS__); } while(0)
  53. #define LOG_OBJC_MAYBE(async, lvl, flg, ctx, frmt, ...) \
  54. AWSDD_LOG_MAYBE(async, lvl, flg, ctx, __PRETTY_FUNCTION__, frmt, ## __VA_ARGS__)
  55. #define AWSDDLogError(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_ERROR, LOG_LEVEL_DEF, LOG_FLAG_ERROR, 0, frmt, ##__VA_ARGS__)
  56. #define AWSDDLogWarn(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_WARN, LOG_LEVEL_DEF, LOG_FLAG_WARN, 0, frmt, ##__VA_ARGS__)
  57. #define AWSDDLogInfo(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_INFO, LOG_LEVEL_DEF, LOG_FLAG_INFO, 0, frmt, ##__VA_ARGS__)
  58. #define AWSDDLogDebug(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_DEBUG, LOG_LEVEL_DEF, LOG_FLAG_DEBUG, 0, frmt, ##__VA_ARGS__)
  59. #define AWSDDLogVerbose(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_VERBOSE, LOG_LEVEL_DEF, LOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__)
  60. #endif