1 #ifndef _LOG_H_ 2 #define _LOG_H_ 3 #include "first.h" 4 5 #include "base_decls.h" 6 #include "buffer.h" 7 8 extern time_t log_epoch_secs; 9 extern time_t log_monotonic_secs; 10 11 struct timespec; /* declaration */ 12 int log_clock_gettime_realtime (struct timespec *ts); 13 int log_clock_gettime_monotonic (struct timespec *ts); 14 15 ssize_t write_all(int fd, const void* buf, size_t count); 16 17 struct log_error_st { 18 enum { ERRORLOG_FILE, ERRORLOG_FD, ERRORLOG_SYSLOG, ERRORLOG_PIPE } errorlog_mode; 19 int errorlog_fd; 20 buffer b; 21 const char *fn; 22 }; 23 24 __attribute_cold__ 25 __attribute_malloc__ 26 __attribute_returns_nonnull__ 27 log_error_st * log_error_st_init (void); 28 29 __attribute_cold__ 30 void log_error_st_free (log_error_st *errh); 31 32 __attribute_cold__ 33 __attribute_format__((__printf__, 4, 5)) 34 void log_error(log_error_st *errh, const char *filename, unsigned int line, const char *fmt, ...); 35 36 __attribute_cold__ 37 __attribute_format__((__printf__, 4, 5)) 38 void log_perror(log_error_st *errh, const char *filename, unsigned int line, const char *fmt, ...); 39 40 __attribute_cold__ 41 __attribute_format__((__printf__, 5, 6)) 42 void log_error_multiline_buffer(log_error_st *errh, const char *filename, unsigned int line, const buffer *multiline, const char *fmt, ...); 43 44 #endif 45