diff options
author | Andreas Schneider <asn@samba.org> | 2014-09-11 08:30:04 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2014-10-01 14:06:18 +0200 |
commit | 7dad23ab56c707a0c5e3780436259781375be0e0 (patch) | |
tree | 72afc2e93a33d25e1e705e4624442a56e14a7e75 /src | |
parent | 20555bf66a555a63a865bd1969a907533de4ccd2 (diff) | |
download | socket_wrapper-7dad23ab56c707a0c5e3780436259781375be0e0.tar.gz socket_wrapper-7dad23ab56c707a0c5e3780436259781375be0e0.tar.xz socket_wrapper-7dad23ab56c707a0c5e3780436259781375be0e0.zip |
swrap: Include the function name in the debug output.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/socket_wrapper.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index 061a820..e0942ed 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -272,10 +272,12 @@ void swrap_destructor(void) DESTRUCTOR_ATTRIBUTE; # define SWRAP_LOG(...) #else -static void swrap_log(enum swrap_dbglvl_e dbglvl, const char *format, ...) PRINTF_ATTRIBUTE(2, 3); -# define SWRAP_LOG(dbglvl, ...) swrap_log((dbglvl), __VA_ARGS__) +static void swrap_log(enum swrap_dbglvl_e dbglvl, const char *func, const char *format, ...) PRINTF_ATTRIBUTE(3, 4); +# define SWRAP_LOG(dbglvl, ...) swrap_log((dbglvl), __func__, __VA_ARGS__) -static void swrap_log(enum swrap_dbglvl_e dbglvl, const char *format, ...) +static void swrap_log(enum swrap_dbglvl_e dbglvl, + const char *func, + const char *format, ...) { char buffer[1024]; va_list va; @@ -295,23 +297,23 @@ static void swrap_log(enum swrap_dbglvl_e dbglvl, const char *format, ...) switch (dbglvl) { case SWRAP_LOG_ERROR: fprintf(stderr, - "SWRAP_ERROR(%d): %s\n", - (int)getpid(), buffer); + "SWRAP_ERROR(%d) - %s: %s\n", + (int)getpid(), func, buffer); break; case SWRAP_LOG_WARN: fprintf(stderr, - "SWRAP_WARN(%d): %s\n", - (int)getpid(), buffer); + "SWRAP_WARN(%d) - %s: %s\n", + (int)getpid(), func, buffer); break; case SWRAP_LOG_DEBUG: fprintf(stderr, - "SWRAP_DEBUG(%d): %s\n", - (int)getpid(), buffer); + "SWRAP_DEBUG(%d) - %s: %s\n", + (int)getpid(), func, buffer); break; case SWRAP_LOG_TRACE: fprintf(stderr, - "SWRAP_TRACE(%d): %s\n", - (int)getpid(), buffer); + "SWRAP_TRACE(%d) - %s: %s\n", + (int)getpid(), func, buffer); break; } } |