洛阳学员端
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.

54 lines
1.5 KiB

9 months ago
  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. #import "OSSCocoaLumberjack.h"
  10. static const OSSDDLogLevel ossLogLevel = OSSDDLogLevelAll;
  11. // colorful log configuration
  12. // see https://github.com/robbiehanson/XcodeColors
  13. #define XCODE_COLORS_ESCAPE @"\033["
  14. #define XCODE_COLORS_RESET_FG XCODE_COLORS_ESCAPE @"fg;" // Clear any foreground color
  15. #define XCODE_COLORS_RESET_BG XCODE_COLORS_ESCAPE @"bg;" // Clear any background color
  16. #define XCODE_COLORS_RESET XCODE_COLORS_ESCAPE @";" // Clear any foreground or background color
  17. #define OSSLogVerbose(frmt, ...)\
  18. if ([OSSLog isLogEnable]) {\
  19. OSSDDLogVerbose(@"[Verbose]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
  20. }
  21. #define OSSLogDebug(frmt, ...)\
  22. if ([OSSLog isLogEnable]) {\
  23. OSSDDLogDebug(@"[Debug]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
  24. }
  25. #define OSSLogDebugNoFile(frmt, ...)\
  26. if ([OSSLog isLogEnable]) {\
  27. NSLog(@"[Debug]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
  28. }
  29. #define OSSLogError(frmt, ...)\
  30. if ([OSSLog isLogEnable]) {\
  31. OSSDDLogError(@"[Error]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
  32. }
  33. #define OSSLogWarn(frmt, ...)\
  34. if ([OSSLog isLogEnable]) {\
  35. OSSDDLogWarn(@"[Warning]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
  36. }
  37. static BOOL isEnable;
  38. @interface OSSLog : NSObject
  39. + (void)enableLog;
  40. + (void)disableLog;
  41. + (BOOL)isLogEnable;
  42. @end