log.h 620 B

1234567891011121314151617181920212223
  1. #define L_ERROR 3
  2. #define L_WARNING 4
  3. #define L_NOTICE 5
  4. #define L_INFO 6
  5. #define L_DEBUG 7
  6. #define L_UNSET 0x29a
  7. void log_printf(int level, const char *fmt, ...);
  8. extern int min_log_level;
  9. #define d(x) log_printf(L_DEBUG, "%s:%d %s", __FILE__, __LINE__, #x);
  10. /* Debug-log the int variable x */
  11. #define dd(x) log_printf(L_DEBUG, "%s:%d %s=%d", __FILE__, __LINE__, #x, (x));
  12. /* Debug-log the pointer variable x */
  13. #define dp(x) log_printf(L_DEBUG, "%s:%d %s=%p", __FILE__, __LINE__, #x, (x));
  14. /* Debug-log the string variable x */
  15. #define ds(x) log_printf(L_DEBUG, "%s:%d %s=%s", __FILE__, __LINE__, #x, (x));