base.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /******************************************************************************
  2. Copyright (c) 2013 by Hugh Bailey <[email protected]>
  3. This software is provided 'as-is', without any express or implied
  4. warranty. In no event will the authors be held liable for any damages
  5. arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it
  8. freely, subject to the following restrictions:
  9. 1. The origin of this software must not be misrepresented; you must not
  10. claim that you wrote the original software. If you use this software
  11. in a product, an acknowledgment in the product documentation would be
  12. appreciated but is not required.
  13. 2. Altered source versions must be plainly marked as such, and must not be
  14. misrepresented as being the original software.
  15. 3. This notice may not be removed or altered from any source
  16. distribution.
  17. ******************************************************************************/
  18. #ifndef BASE_H
  19. #define BASE_H
  20. #include <wctype.h>
  21. #include <stdarg.h>
  22. #include "c99defs.h"
  23. /*
  24. * Just contains logging/crash related stuff
  25. */
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. enum log_type {
  30. LOG_DEBUG,
  31. LOG_INFO,
  32. LOG_WARNING,
  33. LOG_ERROR
  34. };
  35. EXPORT void base_set_log_handler(
  36. void (*handler)(enum log_type, const char *, va_list));
  37. EXPORT void base_set_crash_handler(void (*handler)(const char *, va_list));
  38. EXPORT void blog(enum log_type type, const char *format, ...);
  39. EXPORT void bcrash(const char *format, ...);
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif