10 #ifndef log4c_category_h
11 #define log4c_category_h
25 #include <log4c/defs.h>
31 struct __log4c_appender;
32 struct __log4c_category;
82 LOG4C_API
const char* log4c_category_get_name(
const log4c_category_t* a_category);
90 LOG4C_API
const struct __log4c_appender* log4c_category_get_appender(
99 LOG4C_API
int log4c_category_get_additivity(
const log4c_category_t* a_category);
106 LOG4C_API
int log4c_category_get_priority(
const log4c_category_t* a_category);
119 LOG4C_API
int log4c_category_get_chainedpriority(
const log4c_category_t* a_category);
128 LOG4C_API
const struct __log4c_appender* log4c_category_set_appender(
130 struct __log4c_appender* a_appender);
157 LOG4C_API
void log4c_category_print(
const log4c_category_t* a_category, FILE* a_stream);
166 #if !defined(_WIN32) && !defined(__HP_cc)
170 return log4c_category_get_chainedpriority(a_category) >= a_priority;
173 #define log4c_category_is_priority_enabled(a,b) \
174 (log4c_category_get_chainedpriority(a) >= b)
184 #if !defined(_WIN32) && !defined(__HP_cc)
190 #define log4c_category_is_fatal_enabled(a) \
191 (log4c_category_is_priority_enabled(a,LOG4C_PRIORITY_FATAL))
201 #if !defined(_WIN32) && !defined(__HP_cc)
207 #define log4c_category_is_alert_enabled(a) \
208 (log4c_category_is_priority_enabled(a,LOG4C_PRIORITY_ALERT))
218 #if !defined(_WIN32) && !defined(__HP_cc)
224 #define log4c_category_is_crit_enabled(a) \
225 (log4c_category_is_priority_enabled(a, LOG4C_PRIORITY_CRIT))
235 #if !defined(_WIN32) && !defined(__HP_cc)
241 #define log4c_category_is_error_enabled(a) \
242 (log4c_category_is_priority_enabled(a, LOG4C_PRIORITY_ERROR))
252 #if !defined(_WIN32) && !defined(__HP_cc)
258 #define log4c_category_is_warn_enabled(a) \
259 log4c_category_is_warn_enabled(a) \
260 (log4c_category_is_priority_enabled(a, LOG4C_PRIORITY_WARN))
270 #if !defined(_WIN32) && !defined(__HP_cc)
276 #define log4c_category_is_notice_enabled(a) \
277 (log4c_category_is_priority_enabled(a, LOG4C_PRIORITY_NOTICE))
287 #if !defined(_WIN32) && !defined(__HP_cc)
293 #define log4c_category_is_info_enabled(a) \
294 (log4c_category_is_priority_enabled(a, LOG4C_PRIORITY_INFO))
304 #if !defined(_WIN32) && !defined(__HP_cc)
310 #define log4c_category_is_debug_enabled(a) \
311 (log4c_category_is_priority_enabled(a, LOG4C_PRIORITY_DEBUG))
321 #if !defined(_WIN32) && !defined(__HP_cc)
327 #define log4c_category_is_trace_enabled(a) \
328 (log4c_category_is_priority_enabled(a, LOG4C_PRIORITY_TRACE))
337 const char* a_format,
351 static LOG4C_INLINE
void log4c_category_vlog(
const log4c_category_t* a_category,
353 const char* a_format,
358 __log4c_category_vlog(a_category, &locinfo, a_priority, a_format, a_args);
369 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 3, 4)))
372 const
char* a_format,
377 va_start(va, a_format);
378 log4c_category_vlog(a_category, a_priority, a_format, va);
392 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 4, 5)))
397 const
char* a_format,
402 va_start(va, a_format);
403 __log4c_category_vlog(a_category, a_locinfo, a_priority, a_format, va);
415 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 2, 3)))
417 const
char* a_format,
422 va_start(va, a_format);
435 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 2, 3)))
437 const
char* a_format,
442 va_start(va, a_format);
455 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 2, 3)))
457 const
char* a_format,
462 va_start(va, a_format);
475 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 2, 3)))
477 const
char* a_format,
482 va_start(va, a_format);
495 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 2, 3)))
497 const
char* a_format,
502 va_start(va, a_format);
515 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 2, 3)))
517 const
char* a_format,
522 va_start(va, a_format);
535 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 2, 3)))
537 const
char* a_format,
542 va_start(va, a_format);
555 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 2, 3)))
557 const
char* a_format,
562 va_start(va, a_format);
575 LOG4C_INLINE LOG4C_ATTRIBUTE((format(printf, 2, 3)))
577 const
char* a_format,
582 va_start(va, a_format);
590 #ifdef OLD_VARIADIC_MACRO
592 # define log4c_category_trace(a_category, a_format, args...) \
593 __log4c_category_trace(a_category, log4c_location "\n" a_format, ##args )
597 # define log4c_category_trace(a_category, a_format, ...) \
598 __log4c_category_trace(a_category, log4c_location "\n" a_format, ##__VA_ARGS__ )
604 # define log4c_category_trace __log4c_category_trace
614 # define log4c_category_define(a_category, a_name) \
615 typedef log4c_category_t log4c_category_define_##a_category __attribute__((deprecated)); \
616 static log4c_category_define_##a_category* a_category __attribute__ ((unused)) = NULL;
618 # define log4c_category_define(a_category, a_name)
625 LOG4C_API
struct __sd_factory* log4c_category_factory;