From: Arlin Davis Date: Thu, 6 Mar 2008 23:40:12 +0000 (-0800) Subject: Add hostname and process id to debug output to aid X-Git-Tag: dapl-1.2.6-1~17 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=0f9279ebf21cc2e1bfef72324c810603cea7a609;p=~ardavis%2Fdapl.git Add hostname and process id to debug output to aid scale-up and out debug. Signed-off by: Arlin Davis ardavis@ichips.intel.com --- 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); }