diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-03-25 10:05:49 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-03-25 10:05:49 +0100 |
commit | d5a0d432b679f0c4a8cc0a74d766ba03a008f7d9 (patch) | |
tree | 8d808f7579020e1db8f276ad747cdd31657f3f33 /src/log | |
parent | 9a797e37f07ca227eb2153437fa7d894cab4c244 (diff) | |
download | wolfbones-d5a0d432b679f0c4a8cc0a74d766ba03a008f7d9.tar.gz wolfbones-d5a0d432b679f0c4a8cc0a74d766ba03a008f7d9.tar.bz2 |
fixed logger again, on Unix we stick to strerror_r+wolf_log (simple enough and doesn't introduce dependencies on variadic macros or similar stuff)
Diffstat (limited to 'src/log')
-rw-r--r-- | src/log/log.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/log/log.c b/src/log/log.c index e63194b..c83d149 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -781,69 +781,3 @@ static void wolf_log_ap( wolf_log_level_t level, int category_id, int message_id } #endif /* defined HAVE_EVENTLOG */ } - -#if 0 - -static void wolf_log_win32_ap( wolf_log_level_t level, int category_id, int message_id, const char *format, va_list ap ); - -static void wolf_log_win32_ap( wolf_log_level_t level, int category_id, int message_id, const char *format, va_list ap ) { - DWORD last_error = GetLastError( ); - LPVOID buf; - DWORD buf_size; - DWORD res; - char new_format[1024]; - char int_buf[10]; - - res = FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS | - FORMAT_MESSAGE_MAX_WIDTH_MASK, - NULL, /* message is from system */ - last_error, /* there is a message with that id */ - 0, /* default language preference */ - (LPTSTR)&buf, /* buffer allocated internally with LocalAlloc */ - 0, /* minimum allocation size */ - NULL ); /* no arguments */ - - 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 ); -} - -void wolf_log_win32( wolf_log_level_t level, int category_id, int message_id, const char *format, ... ) { - va_list ap; - - va_start( ap, format ); - wolf_log_win32_ap( level, category_id, message_id, format, ap ); - va_end( ap ); -} - -void wolf_log_strerror_ap( wolf_log_level_t level, int category_id, int message_id, const char *format, va_list ap ) { - int error_no = errno; - char errbuf[512]; - char new_format[1024]; - char int_buf[20]; - - (void)strerror_r( error_no, errbuf, 1024 ); - - strlcpy( new_format, format, 1024 ); - strlcat( new_format, ": ", 1024 ); - strlcat( new_format, errbuf, 1024 ); - strlcat( new_format, " (", 1024 ); - strlcat( new_format, itoa( error_no, int_buf, 10 ), 1024 ); - strlcat( new_format, ")", 1024 ); - - wolf_log_ap( level, category_id, message_id, new_format, ap ); -} - -#endif |