HBLog

cat /opt/theos/vendor/include/_Prefix/HBLog.h

Posted by kunnan on June 13, 2018

/opt/theos/Prefix.pch

/opt/theos/vendor/include/_Prefix

/opt/theos/vendor/include/_Prefix
devzkndeMacBook-Pro:_Prefix devzkn$ tree -L 2
.
├── GCCBackwardsCompat.h
├── HBLog.h
├── IOSMacros.h
├── IOSWebKitCompatHacks.h
└── NullabilityCompat.h

HB_LOG

#include <CoreFoundation/CFLogUtilities.h>

#ifdef __DEBUG__
	#define HB_LOG_FORMAT(color) CFSTR("\e[1;3" #color "m[%s] \e[m\e[0;3" #color "m%s:%d\e[m \e[0;30;4" #color "m%s:\e[m %@")
#else
	#define HB_LOG_FORMAT(color) CFSTR("[%s: %s:%d] %s: %@")
#endif

#define HB_LOG_INTERNAL(color, level, type, ...) CFLog(level, HB_LOG_FORMAT(color), THEOS_INSTANCE_NAME, __BASE_FILE__, __LINE__, type, (__bridge CFStringRef)[NSString stringWithFormat:__VA_ARGS__]);

#ifdef __DEBUG__
	#define HBLogDebug(...) HB_LOG_INTERNAL(6, kCFLogLevelNotice, "DEBUG", __VA_ARGS__)
#else
	#define HBLogDebug(...)
#endif

#define HBLogInfo(...) HB_LOG_INTERNAL(2, kCFLogLevelNotice, "INFO", __VA_ARGS__)
#define HBLogWarn(...) HB_LOG_INTERNAL(3, kCFLogLevelWarning, "WARN", __VA_ARGS__)
#define HBLogError(...) HB_LOG_INTERNAL(1, kCFLogLevelError, "ERROR", __VA_ARGS__)

See Also

/Users/devzkn/bin/knpost HBLog cat /opt/theos/vendor/include/_Prefix/HBLog.h -t objc
#原来""的参数,需要自己加上""

转载请注明: > HBLog