added convenience makros for logging

personal/stbuehler/wip
Thomas Porzelt 15 years ago
parent a662b01aca
commit 49dfcddc2a

@ -30,7 +30,7 @@ int log_write(server* UNUSED_PARAM(srv), connection* UNUSED_PARAM(con), const ch
}
gboolean log_write_(server *srv, connection *con, log_level_t log_level, const char *fmt, ...) {
gboolean log_write_(server *srv, connection *con, log_level_t log_level, const gchar *fmt, ...) {
va_list ap;
GString *log_line;
log_t *log;

@ -46,6 +46,26 @@ LI_API const char *remove_path(const char *path);
LI_API int log_write(server *srv, connection *con, const char *fmt, ...) __ATTRIBUTE_PRINTF_FORMAT(3, 4);
/* convenience makros */
#define log_error(srv, con, fmt, ...) \
log_write_(srv, con, LOG_LEVEL_ERROR, fmt, __VA_ARGS__)
#define log_warning(srv, con, fmt, ...) \
log_write_(srv, con, LOG_LEVEL_WARNING, fmt, __VA_ARGS__)
#define log_info(srv, con, fmt, ...) \
log_write_(srv, con, LOG_LEVEL_INFO, fmt, __VA_ARGS__)
#define log_message(srv, con, fmt, ...) \
log_write_(srv, con, LOG_LEVEL_MESSAGE, fmt, __VA_ARGS__)
#define log_debug(srv, con, fmt, ...) \
log_write_(srv, con, LOG_LEVEL_DEBUG, fmt, __VA_ARGS__)
struct log_t;
typedef struct log_t log_t;
@ -75,5 +95,6 @@ log_t *log_open_file(const gchar* filename);
void log_free(log_t *log);
gpointer log_thread(server *srv);
void log_init(server *srv);
gboolean log_write_(server *srv, connection *con, log_level_t log_level, const gchar *fmt, ...);
#endif

Loading…
Cancel
Save