2005-02-20 14:27:00 +00:00
|
|
|
#ifndef _LOG_H_
|
|
|
|
#define _LOG_H_
|
2016-03-19 15:14:35 +00:00
|
|
|
#include "first.h"
|
2005-02-20 14:27:00 +00:00
|
|
|
|
2017-07-31 03:42:41 +00:00
|
|
|
#include "base_decls.h"
|
2017-06-22 01:41:59 +00:00
|
|
|
#include "buffer.h"
|
|
|
|
|
2019-12-04 06:35:27 +00:00
|
|
|
extern time_t log_epoch_secs;
|
|
|
|
|
2016-07-18 18:24:39 +00:00
|
|
|
struct timespec; /* declaration */
|
|
|
|
int log_clock_gettime_realtime (struct timespec *ts);
|
|
|
|
|
2015-08-22 16:01:08 +00:00
|
|
|
ssize_t write_all(int fd, const void* buf, size_t count);
|
|
|
|
|
2019-03-21 08:03:07 +00:00
|
|
|
struct log_error_st {
|
|
|
|
enum { ERRORLOG_FILE, ERRORLOG_FD, ERRORLOG_SYSLOG, ERRORLOG_PIPE } errorlog_mode;
|
|
|
|
int errorlog_fd;
|
2019-12-08 04:48:24 +00:00
|
|
|
buffer b;
|
2019-12-09 04:02:41 +00:00
|
|
|
const char *fn;
|
2019-03-21 08:03:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
__attribute_cold__
|
2019-12-04 06:35:27 +00:00
|
|
|
log_error_st * log_error_st_init (void);
|
2019-03-21 08:03:07 +00:00
|
|
|
|
|
|
|
__attribute_cold__
|
|
|
|
void log_error_st_free (log_error_st *errh);
|
|
|
|
|
2019-03-21 08:05:21 +00:00
|
|
|
__attribute_cold__
|
|
|
|
__attribute_format__((__printf__, 4, 5))
|
2019-12-08 04:48:24 +00:00
|
|
|
void log_error(log_error_st *errh, const char *filename, unsigned int line, const char *fmt, ...);
|
2019-03-21 08:05:21 +00:00
|
|
|
|
|
|
|
__attribute_cold__
|
|
|
|
__attribute_format__((__printf__, 4, 5))
|
2019-12-08 04:48:24 +00:00
|
|
|
void log_perror(log_error_st *errh, const char *filename, unsigned int line, const char *fmt, ...);
|
2019-03-21 08:05:21 +00:00
|
|
|
|
2019-12-01 20:08:14 +00:00
|
|
|
__attribute_cold__
|
|
|
|
__attribute_format__((__printf__, 5, 6))
|
2019-12-08 04:48:24 +00:00
|
|
|
void log_error_multiline_buffer(log_error_st *errh, const char *filename, unsigned int line, const buffer *multiline, const char *fmt, ...);
|
2019-12-01 20:08:14 +00:00
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
#endif
|