diff --git a/src/syslogd.c b/src/syslogd.c index fc90c40..0976dcd 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -159,7 +159,6 @@ void wallmsg(struct filed *f, struct iovec *iov, int iovcnt); void reapchild(); const char *cvtaddr(struct sockaddr_storage *f, int len); const char *cvthname(struct sockaddr_storage *f, int len); -static void flog(int pri, char *fmt, ...); void domark(); void debug_switch(); void logerror(const char *type); @@ -2008,7 +2007,7 @@ const char *cvthname(struct sockaddr_storage *f, int len) /* * Base function for domark(), logerror(), etc. */ -static void flog(int pri, char *fmt, ...) +void flog(int pri, char *fmt, ...) { struct buf_msg buffer; va_list ap; diff --git a/src/syslogd.h b/src/syslogd.h index 1aeaa6c..8f45e6c 100644 --- a/src/syslogd.h +++ b/src/syslogd.h @@ -112,6 +112,13 @@ #define NELEMS(array) (sizeof(array) / sizeof(array[0])) #endif +/* Helper internal log macros */ +#define ERR(fmt, args...) flog(LOG_SYSLOG | LOG_ERR, fmt ": %m", ##args) +#define ERRX(fmt, args...) flog(LOG_SYSLOG | LOG_ERR, fmt, ##args) +#define WARN(fmt, args...) flog(LOG_SYSLOG | LOG_WARN, fmt, ##args) +#define NOTE(fmt, args...) flog(LOG_SYSLOG | LOG_NOTICE, fmt, ##args) +#define INFO(fmt, args...) flog(LOG_SYSLOG | LOG_INFO, fmt, ##args) + /* * Flags to logmsg(). */ @@ -215,4 +222,6 @@ struct filed { int f_rotatesz; }; +void flog(int pri, char *fmt, ...); + #endif /* SYSKLOGD_SYSLOGD_H_ */