antd-tunnel-publishers/log.h

19 lines
503 B
C
Raw Normal View History

2020-08-03 19:51:58 +02:00
#ifndef LOG_H
#define LOG_H
#include <syslog.h>
#define LOG_INIT(m) do { \
setlogmask (LOG_UPTO (LOG_NOTICE)); \
openlog ((m), LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER); \
} while(0)
#ifdef DEBUG
2020-08-06 23:17:46 +02:00
#define M_LOG(m, a,...) syslog ((LOG_NOTICE),m "_log@[%s: %d]: " a "\n", __FILE__, \
2020-08-03 19:51:58 +02:00
__LINE__, ##__VA_ARGS__)
#else
2020-08-06 23:17:46 +02:00
#define M_LOG(m, a,...) do{}while(0)
2020-08-03 19:51:58 +02:00
#endif
2020-08-06 23:17:46 +02:00
#define M_ERROR(m, a,...) syslog ((LOG_ERR),m "_error@[%s: %d]: " a "\n", __FILE__, \
2020-08-03 19:51:58 +02:00
__LINE__, ##__VA_ARGS__)
#endif