[openib-general] [PATCH] Opensm - add syslog prints in windows

Yael Kalka yael at mellanox.co.il
Mon Feb 6 04:43:31 PST 2006


Hi Hal,

Currently SYSLOG prints are not executed under Windows.
The following patch adds these printings to the Windows stack as well.

Thanks,
Yael

Signed-off-by:  Yael Kalka <yael at mellanox.co.il>

Index: opensm/osm_log.c
===================================================================
--- opensm/osm_log.c    (revision 5307)
+++ opensm/osm_log.c    (working copy)
@@ -105,6 +105,8 @@ osm_log(
   usecs = time_usecs % 1000000;
   localtime_r(&tim, &result);
 
+#endif /* WIN32 */
+
   /* If this is a call to syslog - always print it */
   if ( verbosity & OSM_LOG_SYS )
   {
@@ -122,16 +124,21 @@ osm_log(
     }
 
     /* send it also to the log file */
+#ifdef WIN32
+    GetLocalTime(&st);
+    fprintf( p_log->out_port, "[%02d:%02d:%02d:%03d][%04X] -> %s",
+                     st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
+                     pid, buffer);
+#else
     fprintf( p_log->out_port, "%s %02d %02d:%02d:%02d %06d [%04X] -> %s\n",
              (result.tm_mon < 12 ? month_str[result.tm_mon] : "???"),
              result.tm_mday, result.tm_hour,
              result.tm_min, result.tm_sec,
              usecs, pid, buffer);
     fflush( p_log->out_port );
-    
+#endif    
   }
 
-#endif /* WIN32 */
 
   /* SYS messages go to the log anyways */
   if (p_log->level & verbosity)




More information about the general mailing list