xref: /lighttpd1.4/src/log.h (revision e11f72b1)
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 
10 struct timespec; /* declaration */
11 int log_clock_gettime_realtime (struct timespec *ts);
12 
13 ssize_t write_all(int fd, const void* buf, size_t count);
14 
15 struct log_error_st {
16     enum { ERRORLOG_FILE, ERRORLOG_FD, ERRORLOG_SYSLOG, ERRORLOG_PIPE } errorlog_mode;
17     int errorlog_fd;
18     buffer b;
19     const char *fn;
20 };
21 
22 __attribute_cold__
23 log_error_st * log_error_st_init (void);
24 
25 __attribute_cold__
26 void log_error_st_free (log_error_st *errh);
27 
28 __attribute_cold__
29 __attribute_format__((__printf__, 4, 5))
30 void log_error(log_error_st *errh, const char *filename, unsigned int line, const char *fmt, ...);
31 
32 __attribute_cold__
33 __attribute_format__((__printf__, 4, 5))
34 void log_perror(log_error_st *errh, const char *filename, unsigned int line, const char *fmt, ...);
35 
36 __attribute_cold__
37 __attribute_format__((__printf__, 5, 6))
38 void log_error_multiline_buffer(log_error_st *errh, const char *filename, unsigned int line, const buffer *multiline, const char *fmt, ...);
39 
40 #endif
41