summaryrefslogtreecommitdiff
path: root/src/log
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-03-24 12:38:26 +0100
committerAndreas Baumann <abaumann@yahoo.com>2009-03-24 12:38:26 +0100
commitb305975aaf8052277406ad11291bec3cdce93dff (patch)
tree5332f9a600c94c1eea1ba4453a26e4ba4ed58766 /src/log
parentbea663376a1113c3cf0519f7959cbdd693c8fbc0 (diff)
downloadwolfbones-b305975aaf8052277406ad11291bec3cdce93dff.tar.gz
wolfbones-b305975aaf8052277406ad11291bec3cdce93dff.tar.bz2
started to add stdlib stub for itoa
Diffstat (limited to 'src/log')
-rw-r--r--src/log/log.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/log/log.c b/src/log/log.c
index edbc00d..cb487a6 100644
--- a/src/log/log.c
+++ b/src/log/log.c
@@ -20,7 +20,8 @@
#include "log/messages.h" /* for i18n */
#include "port/stdio.h" /* for vsnprintf, snprintf */
-#include "port/string.h" /* for strcmp, strerror_r, strlen */
+#include "port/string.h" /* for strcmp, strerror_r, strlen,
+ strlcat */
#include "port/time.h" /* for localtime_r, strftime, time
* time_t, struct tm */
#include "port/unused.h" /* for WOLF_UNUSED */
@@ -794,6 +795,8 @@ void wolf_log_win32_ap( wolf_log_level_t level, int category_id, int message_id,
LPVOID buf;
DWORD buf_size;
DWORD res;
+ char new_format[1024];
+ char int_buf[10];
res = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
@@ -805,15 +808,17 @@ void wolf_log_win32_ap( wolf_log_level_t level, int category_id, int message_id,
0, /* minimum allocation size */
NULL ); /* no arguments */
- if( res == 0 ) {
- /* FormatMessage failed, so log the error just with the
- * GetLastError() number
- */
- char new_format[1024];
-
-
- wolf_log_ap( level, category_id, message_id, new_format, ap );
+ strlcpy( new_format, format, 1024 );
+ strlcat( new_format, ": ", 1024 );
+ if( res != 0 ) {
+ strlcat( new_format, buf, 1024 );
}
+
+ strlcat( new_format, "( ", 1024 );
+ strlcat( new_format, itoa( last_error, int_buf, 10 ), 1024 );
+ strlcat( new_format, ")", 1024 );
+
+ wolf_log_ap( level, category_id, message_id, new_format, ap );
}
#endif /* defined _WIN32 */