X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Futils%2Fmono-log-common.c;h=dd20f86b138618eba103b430fac6ca15d20286f5;hb=30cddad5fb4c3d290906a6e6c33ecd8b07d8b48c;hp=4948b91b80fbd84435428d56098e47d751d3b2a0;hpb=626c697b29b8bd625b762044985e4be9ce5b17b5;p=mono.git diff --git a/mono/utils/mono-log-common.c b/mono/utils/mono-log-common.c index 4948b91b80f..dd20f86b138 100644 --- a/mono/utils/mono-log-common.c +++ b/mono/utils/mono-log-common.c @@ -1,5 +1,6 @@ -/* - * mono-log-common.c: Platform-independent interface to the logger +/** + * \file + * Platform-independent interface to the logger * * This module contains the POSIX syslog logger interface * @@ -26,6 +27,7 @@ #include #endif #include "mono-logger-internals.h" +#include "mono-proclib.h" static FILE *logFile = NULL; static void *logUserData = NULL; @@ -55,13 +57,11 @@ mapLogFileLevel(GLogLevelFlags level) } /** - * mono_log_open_logfile - * - * 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. - * - * @path - Path for log file - * @userData - Not used + * mono_log_open_logfile: + * \param path Path for log file + * \param userData Not used + * 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. */ void mono_log_open_logfile(const char *path, void *userData) @@ -88,14 +88,12 @@ mono_log_open_logfile(const char *path, void *userData) } /** - * mono_log_write_logfile - * - * Write data to the log file. - * - * @domain - Identifier string - * @level - Logging level flags - * @format - Printf format string - * @vargs - Variable argument list + * mono_log_write_logfile: + * \param domain Identifier string + * \param level Logging level flags + * \param format \c printf format string + * \param vargs Variable argument list + * Write data to the log file. */ void mono_log_write_logfile (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message) @@ -109,19 +107,20 @@ mono_log_write_logfile (const char *log_domain, GLogLevelFlags level, mono_bool pid_t pid; char logTime [80]; -#ifndef HOST_WIN32 +#ifdef HAVE_LOCALTIME_R struct tm tod; time(&t); localtime_r(&t, &tod); - pid = getpid(); strftime(logTime, sizeof(logTime), "%Y-%m-%d %H:%M:%S", &tod); #else struct tm *tod; time(&t); tod = localtime(&t); - pid = _getpid(); strftime(logTime, sizeof(logTime), "%F %T", tod); #endif + + pid = mono_process_current_pid (); + fprintf (logFile, "%s level[%c] mono[%d]: %s\n", logTime, mapLogFileLevel (level), pid, message); } else { fprintf (logFile, "%s%s%s\n", @@ -137,9 +136,8 @@ mono_log_write_logfile (const char *log_domain, GLogLevelFlags level, mono_bool } /** - * mono_log_close_logfile - * - * Close the log file + * mono_log_close_logfile: + * Close the log file */ void mono_log_close_logfile()