iOS

iOS 带颜色的日志

2015-11-12  本文已影响247人  iOS_成才录

一、封装带颜色的日志

#import <Foundation/Foundation.h>
#import "DDLog.h"
#import "DDTTYLogger.h"
#import "DDFileLogger.h"
#import "MBProgressHUD+JP.h"

#ifdef DEBUG
static const int ddLogLevel = LOG_LEVEL_VERBOSE;
#else
static const int ddLogLevel = LOG_LEVEL_OFF;
#endif

#define classmethod [NSString stringWithFormat:@"[%@ %@] \n",self.class,NSStringFromSelector(_cmd)]


//#define JPLogError(...) DDLogError(__VA_ARGS__)

//错误级别
#define JPLogError(...) DDLogError(@"%@ %@\n",classmethod,[NSString stringWithFormat:__VA_ARGS__])

//警告级别
#define JPLogWarn(...) DDLogWarn(@"%@ %@\n",classmethod,[NSString stringWithFormat:__VA_ARGS__])

//提示级别
#define JPLogInfo(...) DDLogInfo(@"%@ %@\n",classmethod,[NSString stringWithFormat:__VA_ARGS__])

//详情级别
#define JPLogVerbose(...) DDLogVerbose(@"%@ %@\n",classmethod,[NSString stringWithFormat:__VA_ARGS__])

@interface JPColorLog : NSObject

@end
#ifdef __OBJC__
   #import <UIKit/UIKit.h>
   #import <Foundation/Foundation.h>
   #import "JPColorLog.h" // 导入带颜色日志
#endif
上一篇 下一篇

猜你喜欢

热点阅读