diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-07 23:17:50 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-07 23:17:50 +0100 |
commit | 6ada3f4364395fac6c9a64e73492d8826a000127 (patch) | |
tree | 0bd6b80ade74973bf8568b5ae15f78aa74b7d7da /src/fastd.h | |
parent | c6e6c751546124134ed0087bd30a1905a8d4a99d (diff) | |
download | fastd-6ada3f4364395fac6c9a64e73492d8826a000127.tar fastd-6ada3f4364395fac6c9a64e73492d8826a000127.zip |
New debug print function
Diffstat (limited to 'src/fastd.h')
-rw-r--r-- | src/fastd.h | 6 |
1 files changed, 5 insertions, 1 deletions
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) |