test_decoration.module.c 602 B

1234567891011121314151617181920212223242526272829
  1. #define ZF_LOG_LEVEL ZF_LOG_INFO
  2. #define ZF_LOG_LIBRARY_PREFIX module
  3. #include <zf_log.c>
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6. static int module_called;
  7. static void module_output_callback(const zf_log_message *msg, void *arg)
  8. {
  9. (void)arg;
  10. if (strncmp("module", msg->msg_b, (size_t)(msg->p - msg->msg_b)))
  11. {
  12. fprintf(stderr, "incorrect message in module\n");
  13. exit(1);
  14. }
  15. ++module_called;
  16. }
  17. void test_module()
  18. {
  19. zf_log_set_output_v(ZF_LOG_PUT_STD, 0, module_output_callback);
  20. ZF_LOGI("module");
  21. if (!module_called)
  22. {
  23. fprintf(stderr, "module callback was not called\n");
  24. exit(1);
  25. }
  26. }