ndhc/nk/log.h
Nicholas J. Kain 1732bccccc Relicense as MIT.
It's a lot more common than BSD 2-clause it is both compatible
and nearly identical in effect.
2022-02-06 20:05:29 -05:00

28 lines
563 B
C

// Copyright 2003-2020 Nicholas J. Kain <njkain at gmail dot com>
// SPDX-License-Identifier: MIT
#ifndef NCM_LOG_H_
#define NCM_LOG_H_
#include <stdlib.h>
#include <stdio.h>
#define log_line(...) do { \
dprintf(2, __VA_ARGS__); \
dprintf(2, "\n"); } while (0)
#ifndef NDEBUG
#define log_debug(...) do { \
dprintf(2, __VA_ARGS__); \
dprintf(2, "\n"); } while (0)
#else
#define log_debug(...) do {} while (0)
#endif
#define suicide(...) do { \
dprintf(2, __VA_ARGS__); \
dprintf(2, "\n"); \
exit(EXIT_FAILURE); } while (0)
#endif