add new comparison method rgb_difference that resembles arithmetical difference per...
[imager.git] / log.h
... / ...
CommitLineData
1#ifndef _LOG_H_
2#define _LOG_H_
3
4#include <stdio.h>
5#include <stdarg.h>
6#include <time.h>
7#include "imdatatypes.h"
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
14int im_init_log(pIMCTX, const char *name, int onoff );
15#define i_init_log(name, onoff) im_init_log(aIMCTX, name, onoff)
16#ifndef IMAGER_NO_CONTEXT
17void i_fatal ( int exitcode,const char *fmt, ... );
18#endif
19void im_fatal (pIMCTX, int exitcode,const char *fmt, ... );
20void im_lhead ( pIMCTX, const char *file, int line );
21void i_lhead ( const char *file, int line );
22void i_loog(int level,const char *msg, ... ) I_FORMAT_ATTR(2,3);
23void im_loog(pIMCTX, int level,const char *msg, ... ) I_FORMAT_ATTR(3,4);
24
25/*
26=item im_log((aIMCTX, level, format, ...))
27=category Logging
28
29This is the main entry point to logging. Note that the extra set of
30parentheses are required due to limitations in C89 macros.
31
32This will format a string with the current file and line number to the
33log file if logging is enabled.
34
35This must be called with a context object defined by one of the
36C<dIMCTX> macros in scope.
37
38This can also be called as C<mm_log((level, format, args))> in which
39case the currently active context is used and any in scope context is
40ignored.
41
42=cut
43*/
44
45#ifdef IMAGER_LOG
46#ifndef IMAGER_NO_CONTEXT
47#define mm_log(x) { i_lhead(__FILE__,__LINE__); i_loog x; }
48#endif
49#define im_log(x) { im_lhead(aIMCTX, __FILE__,__LINE__); im_loog x; }
50#else
51#define mm_log(x)
52#define im_log(x)
53#endif
54
55
56#endif /* _LOG_H_ */