From 0f9279ebf21cc2e1bfef72324c810603cea7a609 Mon Sep 17 00:00:00 2001 From: Arlin Davis Date: Thu, 6 Mar 2008 15:40:12 -0800 Subject: [PATCH] Add hostname and process id to debug output to aid scale-up and out debug. Signed-off by: Arlin Davis ardavis@ichips.intel.com --- dapl/common/dapl_debug.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dapl/common/dapl_debug.c b/dapl/common/dapl_debug.c index df6c18e..9555f87 100644 --- a/dapl/common/dapl_debug.c +++ b/dapl/common/dapl_debug.c @@ -36,15 +36,25 @@ DAPL_DBG_TYPE g_dapl_dbg_type; /* initialized in dapl_init.c */ DAPL_DBG_DEST g_dapl_dbg_dest; /* initialized in dapl_init.c */ +static char *_ptr_host_ = NULL; +static char _hostname_[128]; + void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...) { va_list args; + if ( _ptr_host_ == NULL ) + { + gethostname(_hostname_, sizeof(_hostname_)); + _ptr_host_ = _hostname_; + } + if ( type & g_dapl_dbg_type ) { if ( DAPL_DBG_DEST_STDOUT & g_dapl_dbg_dest ) { va_start (args, fmt); + fprintf(stdout, "%s:%d: ", _ptr_host_, getpid()); dapl_os_vprintf (fmt, args); va_end (args); } -- 2.41.0