]> rtime.felk.cvut.cz Git - ulut.git/blob - ulut/ul_log.h
uLUt library updated from other projects.
[ulut.git] / ulut / ul_log.h
1 /*******************************************************************
2   uLan Utilities Library - C library of basic reusable constructions
3
4   ul_log.h      - standard logging facility
5
6   (C) Copyright 2005 by Pavel Pisa - Originator
7
8   The uLan utilities library can be used, copied and modified under
9   next licenses
10     - GPL - GNU General Public License
11     - LGPL - GNU Lesser General Public License
12     - MPL - Mozilla Public License
13     - and other licenses added by project originators
14   Code can be modified and re-distributed under any combination
15   of the above listed licenses. If contributor does not agree with
16   some of the licenses, he/she can delete appropriate line.
17   Warning, if you delete all lines, you are not allowed to
18   distribute source code and/or binaries utilizing code.
19   
20   See files COPYING and README for details.
21
22  *******************************************************************/
23
24 #include <ul_logbase.h>
25
26 #define UL_LOG_CUST(log_domain) \
27 \
28 ul_log_domain_t log_domain; \
29 \
30 static inline \
31 void ul_loglev(int level, const char *format, ...) UL_ATTR_PRINTF (2, 3);\
32 static inline \
33 void ul_vloglev(int level, const char *format, va_list ap) \
34 { \
35     ul_vlog(&log_domain, level, format, ap); \
36 } \
37 \
38 static inline \
39 void ul_loglev(int level, const char *format, ...) \
40 { \
41     va_list ap; \
42     va_start(ap, format); \
43     ul_vloglev(level, format, ap); \
44     va_end(ap); \
45 } \
46 \
47 static inline \
48 void ul_logfatal(const char *format, ...) UL_ATTR_PRINTF (1, 2);\
49 static inline \
50 void ul_logfatal(const char *format, ...) \
51 { \
52     va_list ap; \
53     va_start(ap, format); \
54     ul_vloglev(UL_LOGL_FATAL, format, ap); \
55     va_end(ap); \
56 }\
57 \
58 static inline \
59 void ul_logerr(const char *format, ...) UL_ATTR_PRINTF (1, 2);\
60 static inline \
61 void ul_logerr(const char *format, ...) \
62 { \
63     va_list ap; \
64     va_start(ap, format); \
65     ul_vloglev(UL_LOGL_ERR, format, ap); \
66     va_end(ap); \
67 } \
68 \
69 static inline \
70 void ul_logmsg(const char *format, ...) UL_ATTR_PRINTF (1, 2);\
71 static inline \
72 void ul_logmsg(const char *format, ...) \
73 { \
74     va_list ap; \
75     va_start(ap, format); \
76     ul_vloglev(UL_LOGL_MSG, format, ap); \
77     va_end(ap); \
78 } \
79 \
80 static inline \
81 void ul_loginf(const char *format, ...) UL_ATTR_PRINTF (1, 2);\
82 static inline \
83 void ul_loginf(const char *format, ...) \
84 { \
85     va_list ap; \
86     va_start(ap, format); \
87     ul_vloglev(UL_LOGL_INF, format, ap); \
88     va_end(ap); \
89 } \
90 \
91 static inline \
92 void ul_logdeb(const char *format, ...) UL_ATTR_PRINTF (1, 2);\
93 static inline \
94 void ul_logdeb(const char *format, ...) \
95 { \
96     va_list ap; \
97     va_start(ap, format); \
98     ul_vloglev(UL_LOGL_DEB, format, ap); \
99     va_end(ap); \
100 }\
101 \
102 static inline \
103 void ul_logtrash(const char *format, ...) UL_ATTR_PRINTF (1, 2);\
104 static inline \
105 void ul_logtrash(const char *format, ...) \
106 { \
107     va_list ap; \
108     va_start(ap, format); \
109     ul_vloglev(UL_LOGL_TRASH, format, ap); \
110     va_end(ap); \
111 }