test_monolog.c 687 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * This is a test for monolog in $package$
  3. */
  4. #include "si_test.h"
  5. #include "monolog.h"
  6. DEFINE_FILE_LOGGER(file_logger);
  7. DEFINE_STDOUT_LOGGER(stdout_logger);
  8. DEFINE_STDERR_LOGGER(stderr_logger);
  9. TEST_FUNC(monolog) {
  10. monolog_init();
  11. FILE * fout;
  12. fout = fopen("test_monolog.log", "w");
  13. monolog_add_logger(NULL, &stdout_logger);
  14. monolog_add_logger(fout, &file_logger);
  15. LOG_ENABLE_ERROR();
  16. monolog_enable_level("WARNING");
  17. LOG_LEVEL("WARNING", "Warning %d\n", 77);
  18. LOG_ERROR("Error %d\n", 77);
  19. LOG("This is not shown", 77);
  20. /* fclose(fout); */
  21. monolog_done();
  22. TEST_DONE();
  23. }
  24. int main(void) {
  25. TEST_INIT();
  26. TEST_RUN(monolog);
  27. TEST_REPORT();
  28. }