logging.h 931 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef __LOGGING_H__
  2. #define __LOGGING_H__
  3. #include "config.h"
  4. #include <stdbool.h>
  5. #include <stdarg.h>
  6. #ifdef HAVE_SYSLOG_H
  7. #include <syslog.h>
  8. #else
  9. enum {
  10. LOG_ERR,
  11. LOG_WARNING,
  12. LOG_NOTICE,
  13. LOG_INFO,
  14. LOG_DEBUG,
  15. };
  16. #endif
  17. /* original / legacy debug flags */
  18. extern bool opt_debug;
  19. extern bool opt_debug_console;
  20. extern bool opt_log_output;
  21. /* global log_level, messages with lower or equal prio are logged */
  22. extern int opt_log_level;
  23. /* low-level logging functions with priority parameter */
  24. extern void vapplog(int prio, const char *fmt, va_list ap);
  25. extern void applog(int prio, const char *fmt, ...);
  26. /* high-level logging functions with implicit priority */
  27. extern void log_error(const char *fmt, ...);
  28. extern void log_warning(const char *fmt, ...);
  29. extern void log_notice(const char *fmt, ...);
  30. extern void log_info(const char *fmt, ...);
  31. extern void log_debug(const char *fmt, ...);
  32. #endif /* __LOGGING_H__ */