ndhc/nk/log.h

28 lines
563 B
C
Raw Permalink Normal View History

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