NSLog自定义

    xiaoxiao2021-03-25  100

    #ifdef __OBJC__

    #import <UIKit/UIKit.h>

    #import <Foundation/Foundation.h>

    #import "UIView+Extension.h"

    #import "UIBarButtonItem+Extension.h"

    #import "UIWindow+Extension.h"

    #import "NSDate+Extension.h"

    #import "NSString+Extension.h"

    #ifdef DEBUG // 处于开发阶段

    #define HWLog(...) NSLog(__VA_ARGS__)

    #else // 处于发布阶段

    #define HWLog(...)

    #endif

    // RGB颜色

    #define HWColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

    // 随机色

    #define HWRandomColor HWColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))

    #endif

    //下面的自定义NSLog可以输出类名方法名和换行和行数

    // 自定义Log

    #ifdef DEBUG

    #define WCLog(...) NSLog(@"%s %d \n %@\n\n",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])

    #else

    #define WCLog(...)

    #endif

    转载请注明原文地址: https://ju.6miu.com/read-20560.html

    最新回复(0)