log.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * category: [core]
  3. * apply status:
  4. * edit status:
  5. * build status:
  6. * description:
  7. */
  8. #ifndef __XLOG_H__
  9. #define __XLOG_H__
  10. #pragma once
  11. #include "config.h"
  12. #include <stdarg.h>
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #define XLOG_LEVEL_ALL 0
  17. #define XLOG_LEVEL_TRACE 1
  18. #define XLOG_LEVEL_DEBUG 2
  19. #define XLOG_LEVEL_INFO 3
  20. #define XLOG_LEVEL_WARN 4
  21. #define XLOG_LEVEL_ERROR 5
  22. #define XLOG_LEVEL_FATAL 6
  23. #define XLOG_LEVEL_NONE 7
  24. TOOLKIT_API int xlog_add_logger(const char *name, const char *type, ...);
  25. TOOLKIT_API int xlog_remove_logger(const char *name);
  26. TOOLKIT_API int xlog_init(const char *inifile);
  27. TOOLKIT_API int xlog_term();
  28. TOOLKIT_API int xlog_log(const char *inst, int level, const char *str);//跟xlog_init绑定的
  29. TOOLKIT_API int xlog_log_v(const char *inst, int level, const char *fmt, va_list arg);
  30. TOOLKIT_API int xlog_set_level(const char* inst, int level);
  31. TOOLKIT_API int xlog_get_level(const char* inst, int *level);
  32. #ifdef __cplusplus
  33. } // extern "C" {
  34. #endif
  35. #endif //__XLOG_H__