From 6ada3f4364395fac6c9a64e73492d8826a000127 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 7 Mar 2012 23:17:50 +0100 Subject: New debug print function --- src/fastd.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/fastd.h') diff --git a/src/fastd.h b/src/fastd.h index 9ce15e7..93ebf95 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -59,6 +59,8 @@ struct _fastd_method { size_t (*max_packet_size)(fastd_context *ctx); + char* (*peer_str)(const fastd_context *ctx, const fastd_peer *peer); + void (*init)(fastd_context *ctx, fastd_peer *peer); void (*handle_recv)(fastd_context *ctx, fastd_peer *peer, fastd_buffer buffer); @@ -104,8 +106,10 @@ struct _fastd_context { }; +void fastd_printf(const fastd_context *ctx, const char *format, ...); + #define pr_log(ctx, level, prefix, args...) if ((ctx)->conf == NULL || (level) <= (ctx)->conf->loglevel) \ - do { fputs(prefix, stderr); fprintf(stderr, args); fputs("\n", stderr); } while(0) + do { fputs(prefix, stderr); fastd_printf(ctx, args); fputs("\n", stderr); } while(0) #define is_error(ctx) ((ctx)->conf == NULL || LOG_ERROR <= (ctx)->conf->loglevel) #define is_warn(ctx) ((ctx)->conf == NULL || LOG_WARN <= (ctx)->conf->loglevel) -- cgit v1.2.3