Commit | Line | Data |
---|---|---|
02d1d628 AMH |
1 | #ifndef _LOG_H_ |
2 | #define _LOG_H_ | |
3 | ||
4 | #include <stdio.h> | |
5 | #include <stdarg.h> | |
6 | #include <time.h> | |
8d14daab | 7 | #include "imdatatypes.h" |
02d1d628 AMH |
8 | /* |
9 | input: name of file to log too | |
10 | input: onoff, 0 means no logging | |
11 | global: creates a global variable FILE* lg_file | |
12 | */ | |
13 | ||
696cb85d TC |
14 | int im_init_log(pIMCTX, const char *name, int onoff ); |
15 | #define i_init_log(name, onoff) im_init_log(aIMCTX, name, onoff) | |
9d91cc28 | 16 | #ifndef IMAGER_NO_CONTEXT |
10ea52a3 | 17 | void i_fatal ( int exitcode,const char *fmt, ... ); |
9d91cc28 | 18 | #endif |
44d86483 | 19 | void im_fatal (pIMCTX, int exitcode,const char *fmt, ... ); |
696cb85d | 20 | void im_lhead ( pIMCTX, const char *file, int line ); |
bf1573f9 | 21 | void i_lhead ( const char *file, int line ); |
8d14daab | 22 | void i_loog(int level,const char *msg, ... ) I_FORMAT_ATTR(2,3); |
696cb85d | 23 | void im_loog(pIMCTX, int level,const char *msg, ... ) I_FORMAT_ATTR(3,4); |
02d1d628 | 24 | |
bd8052a6 | 25 | /* |
d03fd5a4 | 26 | =item mm_log((level, format, ...)) |
bd8052a6 TC |
27 | =category Logging |
28 | ||
29 | This is the main entry point to logging. Note that the extra set of | |
30 | parentheses are required due to limitations in C89 macros. | |
31 | ||
32 | This will format a string with the current file and line number to the | |
33 | log file if logging is enabled. | |
34 | ||
35 | =cut | |
36 | */ | |
02d1d628 AMH |
37 | |
38 | #ifdef IMAGER_LOG | |
7a62be17 | 39 | #ifndef IMAGER_NO_CONTEXT |
bf1573f9 | 40 | #define mm_log(x) { i_lhead(__FILE__,__LINE__); i_loog x; } |
7a62be17 | 41 | #endif |
696cb85d | 42 | #define im_log(x) { im_lhead(aIMCTX, __FILE__,__LINE__); im_loog x; } |
02d1d628 AMH |
43 | #else |
44 | #define mm_log(x) | |
696cb85d | 45 | #define im_log(x) |
02d1d628 AMH |
46 | #endif |
47 | ||
48 | ||
49 | #endif /* _LOG_H_ */ |