Several corrections thanks to Johan Lorensson
authorNeale Ferguson <neale@sinenomine.net>
Fri, 3 Jun 2016 13:57:11 +0000 (09:57 -0400)
committerNeale Ferguson <neale@sinenomine.net>
Fri, 3 Jun 2016 13:57:11 +0000 (09:57 -0400)
mono/utils/mono-log-common.c
mono/utils/mono-log-windows.c
msvc/libmonoutils.vcxproj

index bb22e6a31479b6f7a2fe0485b8f2c64e47d63bf1..39f68ca160769e13e6b330913de88a88bf5cb417 100644 (file)
@@ -22,6 +22,8 @@
 #include <time.h>
 #ifndef HOST_WIN32
 #include <sys/time.h>
+#else
+#include <process.h>
 #endif
 #include "mono-logger.h"
 
@@ -118,6 +120,9 @@ mono_log_write_logfile(const char *domain, GLogLevelFlags level, mono_bool hdr,
        }
        nLog = sizeof(logMessage) - iLog - 2;
        iLog = vsnprintf(logMessage+iLog, nLog, format, args);
+#ifdef HOST_WIN32
+       logMessage[iLog++] = '\r';
+#endif
        logMessage[iLog++] = '\n';
        logMessage[iLog++] = '\0';
        fputs(logMessage, logFile);
index 2609c1ea9da00231b451172720fb0d14ef3ba614..8139d09ff42738672828c66c29c15b81490e992b 100644 (file)
 #include <glib.h>
 #include <errno.h>
 #include <time.h>
+#include <process.h>
 #include "mono-logger.h"
 
 static FILE *logFile = NULL;
 static void *logUserData = NULL;
-static char *logFileName = L".//mono.log";
+static char logFileName[] = L".//mono.log";
 
 /**
  * mapSyslogLevel:
@@ -53,10 +54,10 @@ mapLogFileLevel(GLogLevelFlags level)
 }
 
 /**
- * mono_log_open_logfile
+ * mono_log_open_syslog
  *     
- *     Open the logfile. If the path is not specified default to stdout. If the
- *     open fails issue a warning and use stdout as the log file destination.
+ *     Open the syslog file. If the open fails issue a warning and 
+ *     use stdout as the log file destination.
  *
  *     @ident - Identifier: ignored
  *     @userData - Not used
@@ -68,14 +69,15 @@ mono_log_open_syslog(const char *ident, void *userData)
        if (logFile == NULL) {
                g_warning("opening of log file %s failed with %s",
                          strerror(errno));
+               logFile = stdout;
        }
        logUserData = userData;
 }
 
 /**
- * mono_log_write_logfile
+ * mono_log_write_syslog
  *     
- *     Write data to the log file.
+ *     Write data to the syslog file.
  *
  *     @domain - Identifier string
  *     @level - Logging level flags
@@ -94,7 +96,7 @@ mono_log_write_syslog(const char *domain, GLogLevelFlags level, mono_bool hdr, c
        size_t nLog;
 
        if (logFile == NULL)
-               mono_log_open_logfile(NULL, NULL);
+               mono_log_open_syslog(NULL, NULL);
 
        time(&t);
        tod = localtime(&t);
@@ -104,6 +106,7 @@ mono_log_write_syslog(const char *domain, GLogLevelFlags level, mono_bool hdr, c
                        logTime,mapLogFileLevel(level),pid);
        nLog = sizeof(logMessage) - iLog - 2;
        iLog = vsnprintf(logMessage+iLog, nLog, format, args);
+       logMessage[iLog++] = '\r';
        logMessage[iLog++] = '\n';
        logMessage[iLog++] = 0;
        fputs(logMessage, logFile);
@@ -114,9 +117,9 @@ mono_log_write_syslog(const char *domain, GLogLevelFlags level, mono_bool hdr, c
 }
 
 /**
- * mono_log_close_logfile
+ * mono_log_close_syslog
  *
- *     Close the log file
+ *     Close the syslog file
  */
 void
 mono_log_close_syslog()
index 3807b9a4ff72d782b025df25d7faa3eb8907cfb7..7ef841f56d0aa72f6a19b58c3876b826db775ea6 100644 (file)
@@ -44,7 +44,6 @@
     <ClCompile Include="..\mono\utils\mono-logger.c" />\r
     <ClCompile Include="..\mono\utils\mono-log-windows.c" />\r
     <ClCompile Include="..\mono\utils\mono-log-common.c" />\r
-    <ClCompile Include="..\mono\utils\mono-log-posix.c" />\r
     <ClCompile Include="..\mono\utils\mono-math.c" />\r
     <ClCompile Include="..\mono\utils\mono-md5.c" />\r
     <ClCompile Include="..\mono\utils\mono-mmap.c" />\r