summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilsimo <ilsimo>2005-10-26 20:20:25 +0000
committerilsimo <ilsimo>2005-10-26 20:20:25 +0000
commitec3016ca878da4e51b34c38416114edcd75378ca (patch)
tree48d7715e6a4354e03a7cd166a25d10c15698cc69
parentba1ea148f47f284b0a0990267fe03de3f36b9d3c (diff)
downloadxrdp-proprietary-ec3016ca878da4e51b34c38416114edcd75378ca.tar.gz
xrdp-proprietary-ec3016ca878da4e51b34c38416114edcd75378ca.zip
fixing some errors in logging functions
- removing warnings created by LOG_DBG() macro - fixing syslog message error - adding platform specific end of line
-rw-r--r--common/log.c24
-rw-r--r--common/log.h2
2 files changed, 18 insertions, 8 deletions
diff --git a/common/log.c b/common/log.c
index 298d9423..734d8de9 100644
--- a/common/log.c
+++ b/common/log.c
@@ -119,15 +119,15 @@ log_message(const unsigned int lvl, const char* msg, ...)
{
return LOG_ERROR_FILE_NOT_OPEN;
}
-
- log_lvl2str(lvl, buff);
now_t = time(&now_t);
now = localtime(&now_t);
- snprintf(buff+8, 21, "[%.4d%.2d%.2d-%.2d:%.2d:%.2d] ", (now->tm_year)+1900, (now->tm_mon)+1,
+ snprintf(buff, 21, "[%.4d%.2d%.2d-%.2d:%.2d:%.2d] ", (now->tm_year)+1900, (now->tm_mon)+1,
now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec);
+ log_lvl2str(lvl, buff+20);
+
va_start(ap, msg);
len = vsnprintf(buff+28, LOG_BUFFER_SIZE, msg, ap);
va_end(ap);
@@ -139,14 +139,24 @@ log_message(const unsigned int lvl, const char* msg, ...)
}
/* forcing the end of message string */
- buff[len+28] = '\r';
- buff[len+29] = '\n';
- buff[len+30] = '\0';
+ #ifdef _WIN32
+ buff[len+28] = '\r';
+ buff[len+29] = '\n';
+ buff[len+30] = '\0';
+ #else
+ #ifdef _MACOS
+ buff[len+28] = '\r';
+ buff[len+29] = '\0';
+ #else
+ buff[len+28] = '\n';
+ buff[len+29] = '\0';
+ #endif
+ #endif
if ( l_cfg->enable_syslog && (lvl <= l_cfg->log_level) )
{
/* log to syslog */
- syslog(log_xrdp2syslog(lvl), msg);
+ syslog(log_xrdp2syslog(lvl), buff+20);
}
if (lvl <= l_cfg->log_level)
diff --git a/common/log.h b/common/log.h
index ccea0e58..32164484 100644
--- a/common/log.h
+++ b/common/log.h
@@ -49,7 +49,7 @@
#ifdef DEBUG
#define LOG_DBG(s,args...) log_message(LOG_LEVEL_DEBUG,s,args);
#else
- #define LOG_DBG
+ #define LOG_DBG(s,args...)
#endif
struct log_config