]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
Add hostname and process id to debug output to aid
authorArlin Davis <arlin.r.davis@intel.com>
Thu, 6 Mar 2008 23:40:12 +0000 (15:40 -0800)
committerArlin Davis <arlin.r.davis@intel.com>
Thu, 6 Mar 2008 23:40:12 +0000 (15:40 -0800)
scale-up and out debug.

Signed-off by: Arlin Davis ardavis@ichips.intel.com

dapl/common/dapl_debug.c

index df6c18e6c5015e91879f5371e9bc7bcffbdbb78a..9555f87d7393d7e23a438d1b619813193456e2ea 100644 (file)
 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);
        }