diff options
Diffstat (limited to 'src/testing/nuts.h')
| -rw-r--r-- | src/testing/nuts.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/testing/nuts.h b/src/testing/nuts.h index f24f7136..da0f525f 100644 --- a/src/testing/nuts.h +++ b/src/testing/nuts.h @@ -17,9 +17,18 @@ #ifndef NNG_TESTING_NUTS_H #define NNG_TESTING_NUTS_H +#include <nng/nng.h> +extern void nuts_logger( + nng_log_level, nng_log_facility, const char *, const char *); + // Call nng_fini during test finalization -- this avoids leak warnings. extern void nng_fini(void); #define TEST_FINI nng_fini() +#define TEST_INIT \ + do { \ + nng_log_set_logger(nuts_logger); \ + nng_log_set_level(NNG_LOG_DEBUG); \ + } while (0) #include "acutest.h" #include <stdbool.h> @@ -27,7 +36,6 @@ extern void nng_fini(void); #include <string.h> // The following headers are provided for test code convenience. -#include <nng/nng.h> #include <nng/protocol/bus0/bus.h> #include <nng/protocol/pair0/pair.h> #include <nng/protocol/pair1/pair.h> @@ -210,6 +218,11 @@ extern const char *nuts_garbled_crt; nng_log_set_level(level); \ } while (0) +#define NUTS_LOGGING() \ + do { \ + nng_log_set_logger(nuts_logger); \ + nng_log_set_level(NNG_LOG_DEBUG); \ + } while (0) #ifdef __cplusplus }; #endif |
