Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adapt to lastest changes in dict: Create dicts before use
[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 #else
280 # define CLOG0(c, p, f)                   _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) _GRAS_LOG_POST                  
281 # define CLOG1(c, p, f,a1)                _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1 _GRAS_LOG_POST              
282 # define CLOG2(c, p, f,a1,a2)             _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2 _GRAS_LOG_POST
283 # define CLOG3(c, p, f,a1,a2,a3)          _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3 _GRAS_LOG_POST
284 # define CLOG4(c, p, f,a1,a2,a3,a4)       _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3,a4 _GRAS_LOG_POST
285 # 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
286 # 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
287 #endif
288
289 #define CDEBUG0(c, f)                   CLOG0(c, gras_log_priority_debug, f)
290 #define CDEBUG1(c, f,a1)                CLOG1(c, gras_log_priority_debug, f,a1)
291 #define CDEBUG2(c, f,a1,a2)             CLOG2(c, gras_log_priority_debug, f,a1,a2)
292 #define CDEBUG3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_debug, f,a1,a2,a3)
293 #define CDEBUG4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_debug, f,a1,a2,a3,a4)
294 #define CDEBUG5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5)
295 #define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
296
297 #define CVERB0(c, f)                   CLOG0(c, gras_log_priority_verbose, f)
298 #define CVERB1(c, f,a1)                CLOG1(c, gras_log_priority_verbose, f,a1)
299 #define CVERB2(c, f,a1,a2)             CLOG2(c, gras_log_priority_verbose, f,a1,a2)
300 #define CVERB3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_verbose, f,a1,a2,a3)
301 #define CVERB4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_verbose, f,a1,a2,a3,a4)
302 #define CVERB5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_verbose, f,a1,a2,a3,a4,a5)
303 #define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
304
305 #define CINFO0(c, f)                   CLOG0(c, gras_log_priority_info, f)
306 #define CINFO1(c, f,a1)                CLOG1(c, gras_log_priority_info, f,a1)
307 #define CINFO2(c, f,a1,a2)             CLOG2(c, gras_log_priority_info, f,a1,a2)
308 #define CINFO3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_info, f,a1,a2,a3)
309 #define CINFO4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_info, f,a1,a2,a3,a4)
310 #define CINFO5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_info, f,a1,a2,a3,a4,a5)
311 #define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_info, f,a1,a2,a3,a4,a5,a6)
312
313 #define CWARNING0(c, f)                   CLOG0(c, gras_log_priority_warning, f)
314 #define CWARNING1(c, f,a1)                CLOG1(c, gras_log_priority_warning, f,a1)
315 #define CWARNING2(c, f,a1,a2)             CLOG2(c, gras_log_priority_warning, f,a1,a2)
316 #define CWARNING3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_warning, f,a1,a2,a3)
317 #define CWARNING4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_warning, f,a1,a2,a3,a4)
318 #define CWARNING5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_warning, f,a1,a2,a3,a4,a5)
319 #define CWARNING6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
320
321 #define CERROR0(c, f)                   CLOG0(c, gras_log_priority_error, f)
322 #define CERROR1(c, f,a1)                CLOG1(c, gras_log_priority_error, f,a1)
323 #define CERROR2(c, f,a1,a2)             CLOG2(c, gras_log_priority_error, f,a1,a2)
324 #define CERROR3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_error, f,a1,a2,a3)
325 #define CERROR4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_error, f,a1,a2,a3,a4)
326 #define CERROR5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_error, f,a1,a2,a3,a4,a5)
327 #define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_error, f,a1,a2,a3,a4,a5,a6)
328
329 /**
330  * CCRITICAL6:
331  * @c: the category to log into
332  * @f: the format string
333  * @a1: first argument of the format
334  * @a2: second argument of the format
335  * @a3: third argument of the format
336  * @a4: fourth argument of the format
337  * @a5: fifth argument of the format
338  * @a6: sixth argument of the format
339  *
340  * Log something to the current default category under the warning priority.
341  *
342  * The macros CCRITICAL0 ... CCRITICAL5 naturally also exist, but are not listed here 
343  * for sake of clarity. They just differ in the number of arguments passed
344  * along with the format string.
345  */
346
347 #define CCRITICAL0(c, f)                   CLOG0(c, gras_log_priority_critical, f)
348 #define CCRITICAL1(c, f,a1)                CLOG1(c, gras_log_priority_critical, f,a1)
349 #define CCRITICAL2(c, f,a1,a2)             CLOG2(c, gras_log_priority_critical, f,a1,a2)
350 #define CCRITICAL3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_critical, f,a1,a2,a3)
351 #define CCRITICAL4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_critical, f,a1,a2,a3,a4)
352 #define CCRITICAL5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_critical, f,a1,a2,a3,a4,a5)
353 #define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
354
355 #ifdef GRAS_LOG_MAYDAY
356 # define LOG0(p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
357 # define LOG1(p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)               
358 # define LOG2(p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)            
359 # define LOG3(p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)         
360 # define LOG4(p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)      
361 # define LOG5(p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)   
362 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
363 #else
364 # define LOG0(p, f)                   _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) _GRAS_LOG_POST
365 # define LOG1(p, f,a1)                _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1 _GRAS_LOG_POST
366 # define LOG2(p, f,a1,a2)             _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2 _GRAS_LOG_POST
367 # define LOG3(p, f,a1,a2,a3)          _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3 _GRAS_LOG_POST
368 # define LOG4(p, f,a1,a2,a3,a4)       _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3,a4 _GRAS_LOG_POST
369 # 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
370 # 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
371 #endif
372
373 /**
374  * DEBUG6:
375  * @f: the format string
376  * @a1: first argument of the format
377  * @a2: second argument of the format
378  * @a3: third argument of the format
379  * @a4: fourth argument of the format
380  * @a5: fifth argument of the format
381  * @a6: sixth argument of the format
382  *
383  * Log something to the current default category under the debug priority.
384  *
385  * The macros DEBUG0 ... DEBUG5 naturally also exist, but are not listed here 
386  * for sake of clarity. They just differ in the number of arguments passed
387  * along with the format string.
388  */
389
390 #define DEBUG0(f)                   LOG0(gras_log_priority_debug, f)
391 #define DEBUG1(f,a1)                LOG1(gras_log_priority_debug, f,a1)
392 #define DEBUG2(f,a1,a2)             LOG2(gras_log_priority_debug, f,a1,a2)
393 #define DEBUG3(f,a1,a2,a3)          LOG3(gras_log_priority_debug, f,a1,a2,a3)
394 #define DEBUG4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_debug, f,a1,a2,a3,a4)
395 #define DEBUG5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_debug, f,a1,a2,a3,a4,a5)
396 #define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
397
398 /**
399  * VERB6:
400  * @f: the format string
401  * @a1: first argument of the format
402  * @a2: second argument of the format
403  * @a3: third argument of the format
404  * @a4: fourth argument of the format
405  * @a5: fifth argument of the format
406  * @a6: sixth argument of the format
407  *
408  * Log something to the current default category under the verbose priority.
409  *
410  * The macros VERB0 ... VERB5 naturally also exist, but are not listed here 
411  * for sake of clarity. They just differ in the number of arguments passed
412  * along with the format string.
413  */
414
415 #define VERB0(f)                   LOG0(gras_log_priority_verbose, f)
416 #define VERB1(f,a1)                LOG1(gras_log_priority_verbose, f,a1)
417 #define VERB2(f,a1,a2)             LOG2(gras_log_priority_verbose, f,a1,a2)
418 #define VERB3(f,a1,a2,a3)          LOG3(gras_log_priority_verbose, f,a1,a2,a3)
419 #define VERB4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_verbose, f,a1,a2,a3,a4)
420 #define VERB5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_verbose, f,a1,a2,a3,a4,a5)
421 #define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
422
423 /**
424  * INFO6:
425  * @f: the format string
426  * @a1: first argument of the format
427  * @a2: second argument of the format
428  * @a3: third argument of the format
429  * @a4: fourth argument of the format
430  * @a5: fifth argument of the format
431  * @a6: sixth argument of the format
432  *
433  * Log something to the current default category under the info priority.
434  *
435  * The macros INFO0 ... INFO5 naturally also exist, but are not listed here 
436  * for sake of clarity. They just differ in the number of arguments passed
437  * along with the format string.
438  */
439
440 #define INFO0(f)                   LOG0(gras_log_priority_info, f)
441 #define INFO1(f,a1)                LOG1(gras_log_priority_info, f,a1)
442 #define INFO2(f,a1,a2)             LOG2(gras_log_priority_info, f,a1,a2)
443 #define INFO3(f,a1,a2,a3)          LOG3(gras_log_priority_info, f,a1,a2,a3)
444 #define INFO4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_info, f,a1,a2,a3,a4)
445 #define INFO5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_info, f,a1,a2,a3,a4,a5)
446 #define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_info, f,a1,a2,a3,a4,a5,a6)
447
448 /**
449  * WARNING6:
450  * @f: the format string
451  * @a1: first argument of the format
452  * @a2: second argument of the format
453  * @a3: third argument of the format
454  * @a4: fourth argument of the format
455  * @a5: fifth argument of the format
456  * @a6: sixth argument of the format
457  *
458  * Log something to the current default category under the warning priority.
459  *
460  * The macros WARNING0 ... WARNING5 naturally also exist, but are not listed here 
461  * for sake of clarity. They just differ in the number of arguments passed
462  * along with the format string.
463  */
464
465 #define WARNING0(f)                   LOG0(gras_log_priority_warning, f)
466 #define WARNING1(f,a1)                LOG1(gras_log_priority_warning, f,a1)
467 #define WARNING2(f,a1,a2)             LOG2(gras_log_priority_warning, f,a1,a2)
468 #define WARNING3(f,a1,a2,a3)          LOG3(gras_log_priority_warning, f,a1,a2,a3)
469 #define WARNING4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_warning, f,a1,a2,a3,a4)
470 #define WARNING5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_warning, f,a1,a2,a3,a4,a5)
471 #define WARNING6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
472
473 /**
474  * ERROR6:
475  * @f: the format string
476  * @a1: first argument of the format
477  * @a2: second argument of the format
478  * @a3: third argument of the format
479  * @a4: fourth argument of the format
480  * @a5: fifth argument of the format
481  * @a6: sixth argument of the format
482  *
483  * Log something to the current default category under the error priority.
484  *
485  * The macros ERROR0 ... ERROR5 naturally also exist, but are not listed here 
486  * for sake of clarity. They just differ in the number of arguments passed
487  * along with the format string.
488  */
489
490 #define ERROR0(f)                   LOG0(gras_log_priority_error, f)
491 #define ERROR1(f,a1)                LOG1(gras_log_priority_error, f,a1)
492 #define ERROR2(f,a1,a2)             LOG2(gras_log_priority_error, f,a1,a2)
493 #define ERROR3(f,a1,a2,a3)          LOG3(gras_log_priority_error, f,a1,a2,a3)
494 #define ERROR4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_error, f,a1,a2,a3,a4)
495 #define ERROR5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_error, f,a1,a2,a3,a4,a5)
496 #define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_error, f,a1,a2,a3,a4,a5,a6)
497
498 /**
499  * CRITICAL6:
500  * @f: the format string
501  * @a1: first argument of the format
502  * @a2: second argument of the format
503  * @a3: third argument of the format
504  * @a4: fourth argument of the format
505  * @a5: fifth argument of the format
506  * @a6: sixth argument of the format
507  *
508  * Log something to the current default category under the critical priority.
509  *
510  * The macros CRITICAL0 ... CRITICAL5 naturally also exist, but are not listed here 
511  * for sake of clarity. They just differ in the number of arguments passed
512  * along with the format string.
513  */
514 #define CRITICAL0(f)                   LOG0(gras_log_priority_critical, f)
515 #define CRITICAL1(f,a1)                LOG1(gras_log_priority_critical, f,a1)
516 #define CRITICAL2(f,a1,a2)             LOG2(gras_log_priority_critical, f,a1,a2)
517 #define CRITICAL3(f,a1,a2,a3)          LOG3(gras_log_priority_critical, f,a1,a2,a3)
518 #define CRITICAL4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_critical, f,a1,a2,a3,a4)
519 #define CRITICAL5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_critical, f,a1,a2,a3,a4,a5)
520 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
521
522 #define GRAS_IN  DEBUG0(">> begin of function")
523 #define GRAS_OUT DEBUG0("<< end of function")
524
525 #endif /* ! _GRAS_LOG_H_ */