Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pmbaty | 1 | // |
2 | // DDLog+LOGV.h |
||
3 | // Lumberjack |
||
4 | // |
||
5 | // Created by Mike Pontillo on 11/20/12. |
||
6 | // |
||
7 | // |
||
8 | |||
9 | #ifndef Lumberjack_DDLog_LOGV_h |
||
10 | #define Lumberjack_DDLog_LOGV_h |
||
11 | |||
12 | #import "DDLog.h" |
||
13 | |||
14 | |||
15 | #define LOGV_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, avalist) \ |
||
16 | [DDLog log:isAsynchronous \ |
||
17 | level:lvl \ |
||
18 | flag:flg \ |
||
19 | context:ctx \ |
||
20 | file:__FILE__ \ |
||
21 | function:fnct \ |
||
22 | line:__LINE__ \ |
||
23 | tag:atag \ |
||
24 | format:frmt \ |
||
25 | args:avalist] |
||
26 | |||
27 | #define LOGV_OBJC_MACRO(async, lvl, flg, ctx, frmt, avalist) \ |
||
28 | LOGV_MACRO(async, lvl, flg, ctx, nil, sel_getName(_cmd), frmt, avalist) |
||
29 | |||
30 | #define LOGV_C_MACRO(async, lvl, flg, ctx, frmt, avalist) \ |
||
31 | LOGV_MACRO(async, lvl, flg, ctx, nil, __FUNCTION__, frmt, avalist) |
||
32 | |||
33 | |||
34 | |||
35 | #define SYNC_LOGV_OBJC_MACRO(lvl, flg, ctx, frmt, avalist) \ |
||
36 | LOGV_OBJC_MACRO( NO, lvl, flg, ctx, frmt, avalist) |
||
37 | |||
38 | #define ASYNC_LOGV_OBJC_MACRO(lvl, flg, ctx, frmt, avalist) \ |
||
39 | LOGV_OBJC_MACRO(YES, lvl, flg, ctx, frmt, avalist) |
||
40 | |||
41 | #define SYNC_LOGV_C_MACRO(lvl, flg, ctx, frmt, avalist) \ |
||
42 | LOGV_C_MACRO( NO, lvl, flg, ctx, frmt, avalist) |
||
43 | |||
44 | #define ASYNC_LOGV_C_MACRO(lvl, flg, ctx, frmt, avalist) \ |
||
45 | LOGV_C_MACRO(YES, lvl, flg, ctx, frmt, avalist) |
||
46 | |||
47 | |||
48 | |||
49 | #define LOGV_MAYBE(async, lvl, flg, ctx, fnct, frmt, avalist) \ |
||
50 | do { if(lvl & flg) LOGV_MACRO(async, lvl, flg, ctx, nil, fnct, frmt, avalist); } while(0) |
||
51 | |||
52 | #define LOGV_OBJC_MAYBE(async, lvl, flg, ctx, frmt, avalist) \ |
||
53 | LOGV_MAYBE(async, lvl, flg, ctx, sel_getName(_cmd), frmt, avalist) |
||
54 | |||
55 | #define LOGV_C_MAYBE(async, lvl, flg, ctx, frmt, avalist) \ |
||
56 | LOGV_MAYBE(async, lvl, flg, ctx, __FUNCTION__, frmt, avalist) |
||
57 | |||
58 | #define SYNC_LOGV_OBJC_MAYBE(lvl, flg, ctx, frmt, avalist) \ |
||
59 | LOGV_OBJC_MAYBE( NO, lvl, flg, ctx, frmt, avalist) |
||
60 | |||
61 | #define ASYNC_LOGV_OBJC_MAYBE(lvl, flg, ctx, frmt, avalist) \ |
||
62 | LOGV_OBJC_MAYBE(YES, lvl, flg, ctx, frmt, avalist) |
||
63 | |||
64 | #define SYNC_LOGV_C_MAYBE(lvl, flg, ctx, frmt, avalist) \ |
||
65 | LOGV_C_MAYBE( NO, lvl, flg, ctx, frmt, avalist) |
||
66 | |||
67 | #define ASYNC_LOGV_C_MAYBE(lvl, flg, ctx, frmt, avalist) \ |
||
68 | LOGV_C_MAYBE(YES, lvl, flg, ctx, frmt, avalist) |
||
69 | |||
70 | |||
71 | |||
72 | #define LOGV_OBJC_TAG_MACRO(async, lvl, flg, ctx, tag, frmt, avalist) \ |
||
73 | LOGV_MACRO(async, lvl, flg, ctx, tag, sel_getName(_cmd), frmt, avalist) |
||
74 | |||
75 | #define LOGV_C_TAG_MACRO(async, lvl, flg, ctx, tag, frmt, avalist) \ |
||
76 | LOGV_MACRO(async, lvl, flg, ctx, tag, __FUNCTION__, frmt, avalist) |
||
77 | |||
78 | #define LOGV_TAG_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, avalist) \ |
||
79 | do { if(lvl & flg) LOGV_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, avalist); } while(0) |
||
80 | |||
81 | #define LOGV_OBJC_TAG_MAYBE(async, lvl, flg, ctx, tag, frmt, avalist) \ |
||
82 | LOGV_TAG_MAYBE(async, lvl, flg, ctx, tag, sel_getName(_cmd), frmt, avalist) |
||
83 | |||
84 | #define LOGV_C_TAG_MAYBE(async, lvl, flg, ctx, tag, frmt, avalist) \ |
||
85 | LOGV_TAG_MAYBE(async, lvl, flg, ctx, tag, __FUNCTION__, frmt, avalist) |
||
86 | |||
87 | |||
88 | |||
89 | #define DDLogvError(frmt, avalist) LOGV_OBJC_MAYBE(LOG_ASYNC_ERROR, ddLogLevel, LOG_FLAG_ERROR, 0, frmt, avalist) |
||
90 | #define DDLogvWarn(frmt, avalist) LOGV_OBJC_MAYBE(LOG_ASYNC_WARN, ddLogLevel, LOG_FLAG_WARN, 0, frmt, avalist) |
||
91 | #define DDLogvInfo(frmt, avalist) LOGV_OBJC_MAYBE(LOG_ASYNC_INFO, ddLogLevel, LOG_FLAG_INFO, 0, frmt, avalist) |
||
92 | #define DDLogvVerbose(frmt, avalist) LOGV_OBJC_MAYBE(LOG_ASYNC_VERBOSE, ddLogLevel, LOG_FLAG_VERBOSE, 0, frmt, avalist) |
||
93 | |||
94 | #define DDLogvCError(frmt, avalist) LOGV_C_MAYBE(LOG_ASYNC_ERROR, ddLogLevel, LOG_FLAG_ERROR, 0, frmt, avalist) |
||
95 | #define DDLogvCWarn(frmt, avalist) LOGV_C_MAYBE(LOG_ASYNC_WARN, ddLogLevel, LOG_FLAG_WARN, 0, frmt, avalist) |
||
96 | #define DDLogvCInfo(frmt, avalist) LOGV_C_MAYBE(LOG_ASYNC_INFO, ddLogLevel, LOG_FLAG_INFO, 0, frmt, avalist) |
||
97 | #define DDLogvCVerbose(frmt, avalist) LOGV_C_MAYBE(LOG_ASYNC_VERBOSE, ddLogLevel, LOG_FLAG_VERBOSE, 0, frmt, avalist) |
||
98 | |||
99 | #endif |