WIP, it compiles
[imager.git] / log.h
CommitLineData
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
156699af
TC
14int im_init_log(pIMCTX, const char *name, int onoff );
15#define i_init_log(name, onoff) im_init_log(aIMCTX, name, onoff)
10ea52a3 16void i_fatal ( int exitcode,const char *fmt, ... );
a482206e 17void im_fatal (pIMCTX, int exitcode,const char *fmt, ... );
156699af 18void im_lhead ( pIMCTX, const char *file, int line );
bf1573f9 19void i_lhead ( const char *file, int line );
8d14daab 20void i_loog(int level,const char *msg, ... ) I_FORMAT_ATTR(2,3);
156699af 21void im_loog(pIMCTX, int level,const char *msg, ... ) I_FORMAT_ATTR(3,4);
02d1d628 22
bd8052a6
TC
23/*
24=item mm_log((level, format, ...))
25=category Logging
26
27This is the main entry point to logging. Note that the extra set of
28parentheses are required due to limitations in C89 macros.
29
30This will format a string with the current file and line number to the
31log file if logging is enabled.
32
33=cut
34*/
02d1d628
AMH
35
36#ifdef IMAGER_LOG
bf1573f9 37#define mm_log(x) { i_lhead(__FILE__,__LINE__); i_loog x; }
156699af 38#define im_log(x) { im_lhead(aIMCTX, __FILE__,__LINE__); im_loog x; }
02d1d628
AMH
39#else
40#define mm_log(x)
156699af 41#define im_log(x)
02d1d628
AMH
42#endif
43
44
45#endif /* _LOG_H_ */