diff options
| author | Jon duSaint | 2026-02-23 21:48:25 -0800 |
|---|---|---|
| committer | Jon duSaint | 2026-02-23 21:48:25 -0800 |
| commit | deff9f834414a25b01159420587c8731efe1b203 (patch) | |
| tree | c378bc5a678158e45f8f8c3f04b6e05d911d34bf | |
| parent | 79a66b932bd85c024bcf12ac346e25817041362d (diff) | |
log.h: used by several programs
| -rw-r--r-- | log.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -0,0 +1,17 @@ +#ifndef LOG_H +#define LOG_H + +#include <stdlib.h> +#include <syslog.h> + +#define info(m,...) message (LOG_INFO, "info[%s:%u]: " m, __func__, __LINE__, ##__VA_ARGS__); +#define warning(m,...) message (LOG_WARNING, "warning[%s:%u]: " m, __func__, __LINE__, ##__VA_ARGS__); +#define error(m,...) message (LOG_ERR, "error[%s:%u]: " m, __func__, __LINE__, ##__VA_ARGS__); +#define fatal(m,...) do { \ + message (LOG_EMERG, "fatal[%s:%u]: " m, __func__, __LINE__, ##__VA_ARGS__); \ + exit (EXIT_FAILURE); \ + } while (0); + +void message (int level, char *const m, ...); + +#endif /* LOG_H */ |
