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 /tests/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 'tests/log')
-rw-r--r-- | tests/log/test_log.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/log/test_log.c b/tests/log/test_log.c index 87c16e6..b3cca7b 100644 --- a/tests/log/test_log.c +++ b/tests/log/test_log.c @@ -1,5 +1,6 @@ #include "log/log.h" /* for logging */ #include "log/messages.h" /* for i18n */ +#include "port/string.h" /* for strerror_r */ #include <stdlib.h> /* for exit, EXIT_SUCCESS, free */ #include <errno.h> /* for errno */ @@ -16,6 +17,8 @@ #define WOLF_MSG_TEST_LOG_MSG7 WOLF_MSG_TEST_LOG_BASE+7 int main( void ) { + char errbuf[512]; + wolf_log_openlogtostderr( WOLF_LOG_NOTICE ); wolf_log_openlogtofile( "test.log", WOLF_LOG_NOTICE ); #if defined WOLF_LOG_HAVE_SYSLOG @@ -41,11 +44,10 @@ int main( void ) { wolf_log( WOLF_LOG_ERR, WOLF_CATEGORY_TEST_LOG, WOLF_MSG_TEST_LOG_MSG6, "This is error %d with %s", 5, "foobar" ); -/* errno = 5; - wolf_log_strerror( WOLF_LOG_ERR, WOLF_CATEGORY_TEST_LOG, WOLF_MSG_TEST_LOG_MSG7, - "A system error occured during %s phase", "fla" ); -*/ + (void)strerror_r( errno, errbuf, 512 ); + wolf_log( WOLF_LOG_ERR, WOLF_CATEGORY_TEST_LOG, WOLF_MSG_TEST_LOG_MSG7, + "A system error occured during %s phase: %s (%d)", "fla", errbuf, errno ); #if defined WOLF_LOG_HAVE_EVENTLOG wolf_log_closelogtoeventlog( ); |