00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef log4c_layout_h
00011 #define log4c_layout_h
00012
00025 #include <log4c/defs.h>
00026 #include <log4c/logging_event.h>
00027 #include <stdio.h>
00028
00029 __LOG4C_BEGIN_DECLS
00030
00031 struct __log4c_layout;
00032
00036 typedef struct __log4c_layout log4c_layout_t;
00037
00046 typedef struct log4c_layout_type {
00047 const char* name;
00048 const char* (*format) (const log4c_layout_t*, const log4c_logging_event_t*);
00049 } log4c_layout_type_t;
00050
00058 LOG4C_API const log4c_layout_type_t* log4c_layout_type_get(const char* a_name);
00059
00080 LOG4C_API const log4c_layout_type_t* log4c_layout_type_set(
00081 const log4c_layout_type_t* a_type);
00082
00090 LOG4C_API log4c_layout_t* log4c_layout_get(const char* a_name);
00091
00095 LOG4C_API log4c_layout_t* log4c_layout_new(const char* a_name);
00096
00100 LOG4C_API void log4c_layout_delete(log4c_layout_t* a_layout);
00101
00106 LOG4C_API const char* log4c_layout_get_name(const log4c_layout_t* a_layout);
00107
00112 LOG4C_API const log4c_layout_type_t* log4c_layout_get_type(
00113 const log4c_layout_t* a_layout);
00114
00123 LOG4C_API const log4c_layout_type_t* log4c_layout_set_type(
00124 log4c_layout_t* a_layout,
00125 const log4c_layout_type_t* a_type);
00126
00131 LOG4C_API void* log4c_layout_get_udata(const log4c_layout_t* a_layout);
00132
00140 LOG4C_API void* log4c_layout_set_udata(log4c_layout_t* a_layout,
00141 void* a_udata);
00149 LOG4C_API const char* log4c_layout_format(
00150 const log4c_layout_t* a_layout,
00151 const log4c_logging_event_t* a_event);
00152
00158 LOG4C_API void log4c_layout_print(
00159 const log4c_layout_t* a_layout, FILE* a_stream);
00160
00166 LOG4C_API void log4c_layout_types_print(FILE *fp);
00167
00178 #ifdef __GNUC__
00179 # define log4c_layout_type_define(a_type) \
00180 typedef int log4c_layout_type_define_##a_type __attribute__((deprecated)); \
00181 static log4c_layout_type_define_##a_type __unsused_var __attribute__((unused));
00182 #else
00183 # define log4c_layout_type_define(a_type)
00184 #endif
00185
00189 struct __sd_factory;
00190 LOG4C_API struct __sd_factory* log4c_layout_factory;
00191
00192 __LOG4C_END_DECLS
00193
00194 #endif