aliyun-oss-react-native

OSSLog.h 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // OSSLog.h
  3. // oss_ios_sdk
  4. //
  5. // Created by zhouzhuo on 8/16/15.
  6. // Copyright (c) 2015 aliyun.com. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. // colorful log configuration
  10. // see https://github.com/robbiehanson/XcodeColors
  11. #define XCODE_COLORS_ESCAPE @"\033["
  12. #define XCODE_COLORS_RESET_FG XCODE_COLORS_ESCAPE @"fg;" // Clear any foreground color
  13. #define XCODE_COLORS_RESET_BG XCODE_COLORS_ESCAPE @"bg;" // Clear any background color
  14. #define XCODE_COLORS_RESET XCODE_COLORS_ESCAPE @";" // Clear any foreground or background color
  15. #define OSSLogVerbose(frmt, ...)\
  16. if ([OSSLog isLogEnable]) {\
  17. NSLog(@"[Verbose]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
  18. }
  19. #define OSSLogDebug(frmt, ...)\
  20. if ([OSSLog isLogEnable]) {\
  21. NSLog(@"[Debug]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
  22. }
  23. #define OSSLogError(frmt, ...)\
  24. if ([OSSLog isLogEnable]) {\
  25. NSLog(@"[Error]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
  26. }
  27. static BOOL isEnable;
  28. @interface OSSLog : NSObject
  29. + (void)enableLog;
  30. + (void)disableLog;
  31. + (BOOL)isLogEnable;
  32. @end