BULogMacros.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // BULogMacros.h
  3. // BUFoundation
  4. //
  5. // Created by Rush.D.Xzj on 2021/2/2.
  6. //
  7. #import <Foundation/Foundation.h>
  8. #import "BULogManager.h"
  9. #import "BUCommonMacros.h"
  10. /** LOG **/
  11. #define BU_Log_Foundation(frmt, ...) BU_LOG_MAYBE(BUFoundationLog, BU_LOG_ENABLED, frmt, ##__VA_ARGS__)
  12. #define BU_LOG_MAYBE(BULogTypeString, flg, frmt, ...) \
  13. do { \
  14. if(flg) [BULogManager debugLogWithFormat:@"[BUAdSDK-%@]-[debug]-[%@]%@", BUSDKVersion, BULogTypeString, [NSString stringWithFormat:frmt,##__VA_ARGS__]]; \
  15. } while(0)
  16. #define BU_LogErrorD(BULogType, frmt, ...) BU_LogBaseD(error, BULogType, frmt, ##__VA_ARGS__)
  17. #define BU_LogWaringD(BULogType, frmt, ...) BU_LogBaseD(warning, BULogType, frmt, ##__VA_ARGS__)
  18. #define BU_LogInfoD(BULogType, frmt, ...) BU_LogBaseD(info, BULogType, frmt, ##__VA_ARGS__)
  19. #define BU_LogDebugD(BULogType, frmt, ...) BU_LogBaseD(debug, BULogType, frmt, ##__VA_ARGS__)
  20. #define BU_LogVerboseD(BULogType, frmt, ...) BU_LogBaseD(verbose, BULogType, frmt, ##__VA_ARGS__)
  21. #define BU_LogInternalD(BULogType, frmt, ...) BU_LogBaseD(internal, BULogType, frmt, ##__VA_ARGS__)
  22. #define BU_LogServerD(BULogType, frmt, ...) BU_LogBaseD(server, BULogType, frmt, ##__VA_ARGS__)
  23. #define BU_LogBaseD(level, BULogType, frmt, ...) [BULogManager level##LogWithFormat:@"[BUAdSDK-%@]-[%s]-[%@]%@", BUSDKVersion, #level, BULogType, [NSString stringWithFormat:frmt, ##__VA_ARGS__]];
  24. #define BU_LogDevInfo(BULogType, frmt, ...) BU_LogDevBase(BULogType, @"🟠", frmt, ##__VA_ARGS__)
  25. #define BU_LogDevSucc(BULogType, frmt, ...) BU_LogDevBase(BULogType, @"🟢", frmt, ##__VA_ARGS__)
  26. #define BU_LogDevFail(BULogType, frmt, ...) BU_LogDevBase(BULogType, @"🔴", frmt, ##__VA_ARGS__)
  27. #define BU_LogDevBase(BULogType, mark, frmt, ...) [BULogManager internalLogWithFormat:@"[BUAdSDK-%@]-[%@ %@]-[%@ %d] %@", BUSDKVersion, BULogType, mark, [NSURL fileURLWithPath:@__FILE__].lastPathComponent, __LINE__, [NSString stringWithFormat:frmt, ##__VA_ARGS__]];
  28. FOUNDATION_EXPORT NSString * const BUFoundationLog;
  29. FOUNDATION_EXPORT BOOL BU_LOG_ENABLED;