1
This commit is contained in:
20
Shared/KBLog.h
Normal file
20
Shared/KBLog.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// KBLog.h
|
||||
// Shared debug logging macro (App + Extension)
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef KBLOG
|
||||
// 调试专用日志(DEBUG 打印,RELEASE 不打印)。尽量显眼,包含函数与行号。
|
||||
#if DEBUG
|
||||
#define KBLOG(fmt, ...) do { \
|
||||
NSString *kb_msg__ = [NSString stringWithFormat:(fmt), ##__VA_ARGS__]; \
|
||||
NSString *kb_full_msg__ = [NSString stringWithFormat:@"\n==============================[KB DEBUG]==============================\n[Function] %s\n[Line] %d\n%@\n=====================================================================\n", __PRETTY_FUNCTION__, __LINE__, kb_msg__]; \
|
||||
fprintf(stderr, "%s", kb_full_msg__.UTF8String); \
|
||||
} while(0)
|
||||
#else
|
||||
#define KBLOG(...)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user