sp_dbg.h 874 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef __SP_DBG_H__
  2. #define __SP_DBG_H__
  3. #pragma once
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. class spDbg
  8. {
  9. public:
  10. spDbg();
  11. int sp_dbg_init(const char *key);
  12. int sp_dbg_set_level(int level);
  13. int sp_dbg_set_output_gui(void *gui);
  14. int sp_dbg_term();
  15. void sp_dbg_trace(const char* str, ...);
  16. void sp_dbg_debug(const char *str, ...);
  17. void sp_dbg_info(const char *str, ...);
  18. void sp_dbg_warn(const char *str, ...);
  19. void sp_dbg_error(const char *str, ...);
  20. void sp_dbg_fatal(const char *str, ...);
  21. static spDbg *getInstance();
  22. void sp_dbg_log(int level, const char *str, va_list arg);
  23. void sp_dbg_logOutMsg(int level, const char* str, va_list arg);
  24. private:
  25. void sp_dbg_buffer_with_level(const char* buf, int level);
  26. char m_inst[128];
  27. int m_initialized;
  28. void *m_gui;
  29. char m_logkey[128];
  30. };
  31. #ifdef __cplusplus
  32. } // extern "C" {
  33. #endif
  34. #endif //__SP_DBG_H__