Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add gras_datadesc_declare_{struct,union}_close; fix the prototypes of the functions...
[simgrid.git] / include / log.h
1 /* $Id$ */
2
3 /* log - a generic logging facility in the spirit of log4j                  */
4
5 /* Authors: Martin Quinson                                                  */
6 /* Copyright (C) 2003, 2004 Martin Quinson.                                 */
7
8 /* This program is free software; you can redistribute it and/or modify it
9    under the terms of the license (GNU LGPL) which comes with this package. */
10
11 /* GRAS_LOG_MAYDAY: define this to replace the logging facilities with basic
12    printf function. Useful to debug the logging facilities themselves */
13 #undef GRAS_LOG_MAYDAY
14 //#define GRAS_LOG_MAYDAY
15
16
17 #ifndef _GRAS_LOG_H_
18 #define _GRAS_LOG_H_
19
20 #include <stdarg.h>
21
22 /**
23  * gras_log_priority_t:
24  * @gras_log_priority_none:          used internally (don't poke with)
25  * @gras_log_priority_debug:         crufty output 
26  * @gras_log_priority_verbose:       verbose output for the user wanting more
27  * @gras_log_priority_info:          output about the regular functionning 
28  * @gras_log_priority_warning:       minor issue encountered 
29  * @gras_log_priority_error:         issue encountered 
30  * @gras_log_priority_critical:      major issue encountered 
31  * @gras_log_priority_infinite:      value for GRAS_LOG_STATIC_THRESHOLD to not log
32  * @gras_log_priority_uninitialized: used internally (don't poke with)
33  *
34  * The different existing priorities.
35  */
36 typedef enum {
37   gras_log_priority_none          = 0, 
38   gras_log_priority_debug         = 1, 
39   gras_log_priority_verbose       = 2, 
40   gras_log_priority_info          = 3, 
41   gras_log_priority_warning       = 4, 
42   gras_log_priority_error         = 5, 
43   gras_log_priority_critical      = 6, 
44
45   gras_log_priority_infinite      = 7, 
46
47   gras_log_priority_uninitialized = -1 
48 } gras_log_priority_t;
49               
50
51 /**
52  * GRAS_LOG_STATIC_THRESHOLD:
53  *
54  * All logging with priority < GRAS_LOG_STATIC_THRESHOLD is disabled at
55  * compile time, i.e., compiled out.
56  */
57 #ifndef GRAS_LOG_STATIC_THRESHOLD
58 #  define GRAS_LOG_STATIC_THRESHOLD gras_log_priority_none
59 #endif
60
61
62 /* Transforms a category name to a global variable name. */
63 #define _GRAS_LOGV(cat)   _GRAS_LOG_CONCAT(_gras_this_log_category_does_not_exist__, cat)
64 #define _GRAS_LOG_CONCAT(x,y) x ## y
65
66 /* The root of the category hierarchy. */
67 #define GRAS_LOG_ROOT_CAT   root
68
69 /**
70  * GRAS_LOG_NEW_SUBCATEGORY:
71  * @catName: name of new category
72  * @parent: father of the new category in the tree
73  *
74  * Defines a new subcategory of the parent. 
75  */
76 #define GRAS_LOG_NEW_SUBCATEGORY(catName, parent)     \
77     extern gras_log_category_t _GRAS_LOGV(parent);    \
78     gras_log_category_t _GRAS_LOGV(catName) = {       \
79         &_GRAS_LOGV(parent), 0, 0,                    \
80         #catName, gras_log_priority_uninitialized, 1, \
81         0, 1                                          \
82     };
83
84 /**
85  * GRAS_LOG_NEW_CATEGORY:
86  * @catName: name of new category
87  *
88  * Creates a new subcategory of the root category.
89  */
90 #define GRAS_LOG_NEW_CATEGORY(catName)  GRAS_LOG_NEW_SUBCATEGORY(catName, GRAS_LOG_ROOT_CAT)
91
92 /**
93  * GRAS_LOG_DEFAULT_CATEGORY:
94  * @cname: name of the cat
95  *
96  * Indicates which category is the default one.
97  */
98
99 #ifdef GRAS_LOG_MAYDAY /* debuging the logs themselves */
100 # define GRAS_LOG_DEFAULT_CATEGORY(cname)
101 #else
102 # define GRAS_LOG_DEFAULT_CATEGORY(cname) \
103          static gras_log_category_t* _GRAS_LOGV(default) = &_GRAS_LOGV(cname)
104 #endif
105
106 /**
107  * GRAS_LOG_NEW_DEFAULT_CATEGORY:
108  * @cname: name of the cat
109  *
110  * Creates a new subcategory of the root category and makes it the default
111  * (used by macros that don't explicitly specify a category).
112  */
113 #define GRAS_LOG_NEW_DEFAULT_CATEGORY(cname)        \
114     GRAS_LOG_NEW_CATEGORY(cname)                    \
115     GRAS_LOG_DEFAULT_CATEGORY(cname)
116
117 /**
118  * GRAS_LOG_NEW_DEFAULT_SUBCATEGORY:
119  * @cname: name of the cat
120  * @parent: name of the parent
121  *
122  * Creates a new subcategory of the parent category and makes it the default
123  * (used by macros that don't explicitly specify a category).
124  */
125 #define GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent)     \
126     GRAS_LOG_NEW_SUBCATEGORY(cname, parent)                 \
127     GRAS_LOG_DEFAULT_CATEGORY(cname)
128
129 /**
130  * GRAS_LOG_EXTERNAL_CATEGORY:
131  * @cname: name of the cat
132  *
133  * Indicates that a category you'll use in this file (to get subcategories of it, 
134  * for example) really lives in another file.
135  */
136
137 #define GRAS_LOG_EXTERNAL_CATEGORY(cname) \
138    extern gras_log_category_t _GRAS_LOGV(cname)
139
140 // Functions you may call
141
142 extern gras_error_t gras_log_control_set(const char* cs);
143
144 // Forward declarations
145 typedef struct gras_log_appender_s gras_log_appender_t;
146 typedef struct gras_log_event_s    gras_log_event_t;
147 typedef struct gras_log_category_s gras_log_category_t;
148
149 /**
150  * Do NOT access any members of this structure directly.
151  */
152 struct gras_log_category_s {
153   gras_log_category_t *parent;
154   gras_log_category_t *firstChild, *nextSibling;
155   const char *name;
156   int threshold;
157   int isThreshInherited;
158   gras_log_appender_t *appender;
159   int willLogToParent;
160   // TODO: Formats?
161 };
162
163 struct gras_log_appender_s {
164   void (*do_append) (gras_log_appender_t* thisLogAppender,
165                     gras_log_event_t* event);
166   void *appender_data;
167 };
168
169 struct gras_log_event_s {
170   gras_log_category_t* cat;
171   gras_log_priority_t priority;
172   const char* fileName;
173   const char* functionName;
174   int lineNum;
175   const char* fmt;
176   va_list ap;
177 };
178
179 /**
180  * gras_log_threshold_set:
181  * @cat: the category (not only its name, but the variable)
182  * @thresholdPriority: the priority
183  *
184  * Programatically alters a category's threshold priority (don't use).
185  */
186 extern void gras_log_threshold_set(gras_log_category_t* cat,
187                                    gras_log_priority_t thresholdPriority);
188
189 /**
190  * gras_log_parent_set:
191  * @cat: the category (not only its name, but the variable)
192  * @parent: the parent cat
193  *
194  * Programatically alter a category's parent (don't use).
195  */
196 extern void gras_log_parent_set(gras_log_category_t* cat, 
197                                 gras_log_category_t* parent);
198
199 /**
200  * gras_log_appender_set:
201  * @cat: the category (not only its name, but the variable)
202  * @app: the appender
203  *
204  * Programatically sets the category's appender (don't use).
205  */
206 extern void gras_log_appender_set(gras_log_category_t* cat,
207                                   gras_log_appender_t* app);
208
209 // Functions that you shouldn't call. 
210 extern void _gras_log_event_log(gras_log_event_t*ev,
211                                 ...);
212 extern int _gras_log_cat_init(gras_log_priority_t priority, 
213                               gras_log_category_t* category);
214
215
216 extern gras_log_category_t _GRAS_LOGV(GRAS_LOG_ROOT_CAT);
217 GRAS_LOG_EXTERNAL_CATEGORY(GRAS);
218 extern gras_log_appender_t *gras_log_default_appender;
219
220 /**
221  * GRAS_LOG_ISENABLED:
222  * @catName: name of the category
223  * @priority: minimal priority to be enabled to return true
224  *
225  * Returns true if the given priority is enabled for the category.
226  * If you have expensive expressions that are computed outside of the log
227  * command and used only within it, you should make its evaluation conditional
228  * using this macro.
229  */
230 #define GRAS_LOG_ISENABLED(catName, priority) \
231             _GRAS_LOG_ISENABLEDV(_GRAS_LOGV(catName), priority)
232
233 /*
234  * Helper function that implements GRAS_LOG_ISENABLED.
235  *
236  * NOTES
237  * First part is a compile-time constant.
238  * Call to _log_initCat only happens once.
239  */
240 #define _GRAS_LOG_ISENABLEDV(catv, priority)                  \
241        (priority >= GRAS_LOG_STATIC_THRESHOLD                 \
242         && priority >= catv.threshold                         \
243         && (catv.threshold != gras_log_priority_uninitialized \
244             || _gras_log_cat_init(priority, &catv)) )
245
246 /*
247  * Internal Macros
248  * Some kludge macros to ease maintenance. See how they're used below.
249  *
250  * IMPLEMENTATION NOTE: To reduce the parameter passing overhead of an enabled
251  * message, the many parameters passed to the logging function are packed in a
252  * structure. Since these values will be usually be passed to at least 3
253  * functions, this is a win.
254  * It also allows adding new values (such as a timestamp) without breaking
255  * code. 
256  * Setting the LogEvent's valist member is done inside _log_logEvent.
257  */
258
259 #define _GRAS_LOG_PRE(catv, priority, fmt) do {                         \
260      if (_GRAS_LOG_ISENABLEDV(catv, priority)) {                        \
261          gras_log_event_t _log_ev =                                     \
262              {&(catv),priority,__FILE__,__FUNCTION__,__LINE__,fmt};         \
263          _gras_log_event_log(&_log_ev
264 #define _GRAS_LOG_POST                          \
265                         );                      \
266      } } while(0)
267
268
269 /* Logging Macros */
270
271 #ifdef GRAS_LOG_MAYDAY
272 # define CLOG0(c, p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
273 # define CLOG1(c, p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)               
274 # define CLOG2(c, p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)            
275 # define CLOG3(c, p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)         
276 # define CLOG4(c, p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)      
277 # define CLOG5(c, p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)   
278 # define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
279 # define CLOG7(c, p, f,a1,a2,a3,a4,a5,a6,a7) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7)
280 # define CLOG8(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8)
281 #else
282 # define CLOG0(c, p, f)                   _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) _GRAS_LOG_POST                  
283 # define CLOG1(c, p, f,a1)                _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1 _GRAS_LOG_POST              
284 # define CLOG2(c, p, f,a1,a2)             _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2 _GRAS_LOG_POST
285 # define CLOG3(c, p, f,a1,a2,a3)          _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3 _GRAS_LOG_POST
286 # define CLOG4(c, p, f,a1,a2,a3,a4)       _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3,a4 _GRAS_LOG_POST
287 # define CLOG5(c, p, f,a1,a2,a3,a4,a5)    _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3,a4,a5 _GRAS_LOG_POST
288 # define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3,a4,a5,a6 _GRAS_LOG_POST
289 # define CLOG7(c, p, f,a1,a2,a3,a4,a5,a6,a7) _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3,a4,a5,a6,a7 _GRAS_LOG_POST
290 # define CLOG8(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8) _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3,a4,a5,a6,a7,a8 _GRAS_LOG_POST
291 #endif
292
293 #define CDEBUG0(c, f)                   CLOG0(c, gras_log_priority_debug, f)
294 #define CDEBUG1(c, f,a1)                CLOG1(c, gras_log_priority_debug, f,a1)
295 #define CDEBUG2(c, f,a1,a2)             CLOG2(c, gras_log_priority_debug, f,a1,a2)
296 #define CDEBUG3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_debug, f,a1,a2,a3)
297 #define CDEBUG4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_debug, f,a1,a2,a3,a4)
298 #define CDEBUG5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5)
299 #define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
300 #define CDEBUG7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
301 #define CDEBUG8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
302
303 #define CVERB0(c, f)                   CLOG0(c, gras_log_priority_verbose, f)
304 #define CVERB1(c, f,a1)                CLOG1(c, gras_log_priority_verbose, f,a1)
305 #define CVERB2(c, f,a1,a2)             CLOG2(c, gras_log_priority_verbose, f,a1,a2)
306 #define CVERB3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_verbose, f,a1,a2,a3)
307 #define CVERB4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_verbose, f,a1,a2,a3,a4)
308 #define CVERB5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_verbose, f,a1,a2,a3,a4,a5)
309 #define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
310
311 #define CINFO0(c, f)                   CLOG0(c, gras_log_priority_info, f)
312 #define CINFO1(c, f,a1)                CLOG1(c, gras_log_priority_info, f,a1)
313 #define CINFO2(c, f,a1,a2)             CLOG2(c, gras_log_priority_info, f,a1,a2)
314 #define CINFO3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_info, f,a1,a2,a3)
315 #define CINFO4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_info, f,a1,a2,a3,a4)
316 #define CINFO5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_info, f,a1,a2,a3,a4,a5)
317 #define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_info, f,a1,a2,a3,a4,a5,a6)
318
319 #define CWARN0(c, f)                   CLOG0(c, gras_log_priority_warning, f)
320 #define CWARN1(c, f,a1)                CLOG1(c, gras_log_priority_warning, f,a1)
321 #define CWARN2(c, f,a1,a2)             CLOG2(c, gras_log_priority_warning, f,a1,a2)
322 #define CWARN3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_warning, f,a1,a2,a3)
323 #define CWARN4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_warning, f,a1,a2,a3,a4)
324 #define CWARN5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_warning, f,a1,a2,a3,a4,a5)
325 #define CWARN6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
326
327 #define CERROR0(c, f)                   CLOG0(c, gras_log_priority_error, f)
328 #define CERROR1(c, f,a1)                CLOG1(c, gras_log_priority_error, f,a1)
329 #define CERROR2(c, f,a1,a2)             CLOG2(c, gras_log_priority_error, f,a1,a2)
330 #define CERROR3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_error, f,a1,a2,a3)
331 #define CERROR4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_error, f,a1,a2,a3,a4)
332 #define CERROR5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_error, f,a1,a2,a3,a4,a5)
333 #define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_error, f,a1,a2,a3,a4,a5,a6)
334
335 /**
336  * CCRITICAL6:
337  * @c: the category to log into
338  * @f: the format string
339  * @a1: first argument of the format
340  * @a2: second argument of the format
341  * @a3: third argument of the format
342  * @a4: fourth argument of the format
343  * @a5: fifth argument of the format
344  * @a6: sixth argument of the format
345  *
346  * Log something to the current default category under the warning priority.
347  *
348  * The macros CCRITICAL0 ... CCRITICAL5 naturally also exist, but are not listed here 
349  * for sake of clarity. They just differ in the number of arguments passed
350  * along with the format string.
351  */
352
353 #define CCRITICAL0(c, f)                   CLOG0(c, gras_log_priority_critical, f)
354 #define CCRITICAL1(c, f,a1)                CLOG1(c, gras_log_priority_critical, f,a1)
355 #define CCRITICAL2(c, f,a1,a2)             CLOG2(c, gras_log_priority_critical, f,a1,a2)
356 #define CCRITICAL3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_critical, f,a1,a2,a3)
357 #define CCRITICAL4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_critical, f,a1,a2,a3,a4)
358 #define CCRITICAL5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_critical, f,a1,a2,a3,a4,a5)
359 #define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
360
361 #ifdef GRAS_LOG_MAYDAY
362 # define LOG0(p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
363 # define LOG1(p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)               
364 # define LOG2(p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)            
365 # define LOG3(p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)         
366 # define LOG4(p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)      
367 # define LOG5(p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)   
368 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
369 # define LOG7(p, f,a1,a2,a3,a4,a5,a6,a7) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7)
370 # define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8)
371 #else
372 # define LOG0(p, f)                   _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) _GRAS_LOG_POST
373 # define LOG1(p, f,a1)                _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1 _GRAS_LOG_POST
374 # define LOG2(p, f,a1,a2)             _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2 _GRAS_LOG_POST
375 # define LOG3(p, f,a1,a2,a3)          _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3 _GRAS_LOG_POST
376 # define LOG4(p, f,a1,a2,a3,a4)       _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3,a4 _GRAS_LOG_POST
377 # define LOG5(p, f,a1,a2,a3,a4,a5)    _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3,a4,a5 _GRAS_LOG_POST
378 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3,a4,a5,a6 _GRAS_LOG_POST
379 # define LOG7(p, f,a1,a2,a3,a4,a5,a6,a7) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3,a4,a5,a6,a7 _GRAS_LOG_POST
380 # define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3,a4,a5,a6,a7,a8 _GRAS_LOG_POST
381 #endif
382
383 /**
384  * DEBUG6:
385  * @f: the format string
386  * @a1: first argument of the format
387  * @a2: second argument of the format
388  * @a3: third argument of the format
389  * @a4: fourth argument of the format
390  * @a5: fifth argument of the format
391  * @a6: sixth argument of the format
392  *
393  * Log something to the current default category under the debug priority.
394  *
395  * The macros DEBUG0 ... DEBUG5 naturally also exist, but are not listed here 
396  * for sake of clarity. They just differ in the number of arguments passed
397  * along with the format string.
398  */
399
400 #define DEBUG0(f)                   LOG0(gras_log_priority_debug, f)
401 #define DEBUG1(f,a1)                LOG1(gras_log_priority_debug, f,a1)
402 #define DEBUG2(f,a1,a2)             LOG2(gras_log_priority_debug, f,a1,a2)
403 #define DEBUG3(f,a1,a2,a3)          LOG3(gras_log_priority_debug, f,a1,a2,a3)
404 #define DEBUG4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_debug, f,a1,a2,a3,a4)
405 #define DEBUG5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_debug, f,a1,a2,a3,a4,a5)
406 #define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
407 #define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
408 #define DEBUG8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
409
410 /**
411  * VERB6:
412  * @f: the format string
413  * @a1: first argument of the format
414  * @a2: second argument of the format
415  * @a3: third argument of the format
416  * @a4: fourth argument of the format
417  * @a5: fifth argument of the format
418  * @a6: sixth argument of the format
419  *
420  * Log something to the current default category under the verbose priority.
421  *
422  * The macros VERB0 ... VERB5 naturally also exist, but are not listed here 
423  * for sake of clarity. They just differ in the number of arguments passed
424  * along with the format string.
425  */
426
427 #define VERB0(f)                   LOG0(gras_log_priority_verbose, f)
428 #define VERB1(f,a1)                LOG1(gras_log_priority_verbose, f,a1)
429 #define VERB2(f,a1,a2)             LOG2(gras_log_priority_verbose, f,a1,a2)
430 #define VERB3(f,a1,a2,a3)          LOG3(gras_log_priority_verbose, f,a1,a2,a3)
431 #define VERB4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_verbose, f,a1,a2,a3,a4)
432 #define VERB5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_verbose, f,a1,a2,a3,a4,a5)
433 #define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
434
435 /**
436  * INFO6:
437  * @f: the format string
438  * @a1: first argument of the format
439  * @a2: second argument of the format
440  * @a3: third argument of the format
441  * @a4: fourth argument of the format
442  * @a5: fifth argument of the format
443  * @a6: sixth argument of the format
444  *
445  * Log something to the current default category under the info priority.
446  *
447  * The macros INFO0 ... INFO5 naturally also exist, but are not listed here 
448  * for sake of clarity. They just differ in the number of arguments passed
449  * along with the format string.
450  */
451
452 #define INFO0(f)                   LOG0(gras_log_priority_info, f)
453 #define INFO1(f,a1)                LOG1(gras_log_priority_info, f,a1)
454 #define INFO2(f,a1,a2)             LOG2(gras_log_priority_info, f,a1,a2)
455 #define INFO3(f,a1,a2,a3)          LOG3(gras_log_priority_info, f,a1,a2,a3)
456 #define INFO4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_info, f,a1,a2,a3,a4)
457 #define INFO5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_info, f,a1,a2,a3,a4,a5)
458 #define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_info, f,a1,a2,a3,a4,a5,a6)
459
460 /**
461  * WARN6:
462  * @f: the format string
463  * @a1: first argument of the format
464  * @a2: second argument of the format
465  * @a3: third argument of the format
466  * @a4: fourth argument of the format
467  * @a5: fifth argument of the format
468  * @a6: sixth argument of the format
469  *
470  * Log something to the current default category under the warning priority.
471  *
472  * The macros WARN0 ... WARN5 naturally also exist, but are not listed here 
473  * for sake of clarity. They just differ in the number of arguments passed
474  * along with the format string.
475  */
476
477 #define WARN0(f)                   LOG0(gras_log_priority_warning, f)
478 #define WARN1(f,a1)                LOG1(gras_log_priority_warning, f,a1)
479 #define WARN2(f,a1,a2)             LOG2(gras_log_priority_warning, f,a1,a2)
480 #define WARN3(f,a1,a2,a3)          LOG3(gras_log_priority_warning, f,a1,a2,a3)
481 #define WARN4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_warning, f,a1,a2,a3,a4)
482 #define WARN5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_warning, f,a1,a2,a3,a4,a5)
483 #define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
484
485 /**
486  * ERROR6:
487  * @f: the format string
488  * @a1: first argument of the format
489  * @a2: second argument of the format
490  * @a3: third argument of the format
491  * @a4: fourth argument of the format
492  * @a5: fifth argument of the format
493  * @a6: sixth argument of the format
494  *
495  * Log something to the current default category under the error priority.
496  *
497  * The macros ERROR0 ... ERROR5 naturally also exist, but are not listed here 
498  * for sake of clarity. They just differ in the number of arguments passed
499  * along with the format string.
500  */
501
502 #define ERROR0(f)                   LOG0(gras_log_priority_error, f)
503 #define ERROR1(f,a1)                LOG1(gras_log_priority_error, f,a1)
504 #define ERROR2(f,a1,a2)             LOG2(gras_log_priority_error, f,a1,a2)
505 #define ERROR3(f,a1,a2,a3)          LOG3(gras_log_priority_error, f,a1,a2,a3)
506 #define ERROR4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_error, f,a1,a2,a3,a4)
507 #define ERROR5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_error, f,a1,a2,a3,a4,a5)
508 #define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_error, f,a1,a2,a3,a4,a5,a6)
509
510 /**
511  * CRITICAL6:
512  * @f: the format string
513  * @a1: first argument of the format
514  * @a2: second argument of the format
515  * @a3: third argument of the format
516  * @a4: fourth argument of the format
517  * @a5: fifth argument of the format
518  * @a6: sixth argument of the format
519  *
520  * Log something to the current default category under the critical priority.
521  *
522  * The macros CRITICAL0 ... CRITICAL5 naturally also exist, but are not listed here 
523  * for sake of clarity. They just differ in the number of arguments passed
524  * along with the format string.
525  */
526 #define CRITICAL0(f)                   LOG0(gras_log_priority_critical, f)
527 #define CRITICAL1(f,a1)                LOG1(gras_log_priority_critical, f,a1)
528 #define CRITICAL2(f,a1,a2)             LOG2(gras_log_priority_critical, f,a1,a2)
529 #define CRITICAL3(f,a1,a2,a3)          LOG3(gras_log_priority_critical, f,a1,a2,a3)
530 #define CRITICAL4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_critical, f,a1,a2,a3,a4)
531 #define CRITICAL5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_critical, f,a1,a2,a3,a4,a5)
532 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
533
534 #define GRAS_IN  DEBUG0(">> begin of function")
535 #define GRAS_OUT DEBUG0("<< end of function")
536
537 #endif /* ! _GRAS_LOG_H_ */