2022-02-07 06:35:29 +05:30
|
|
|
// 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_
|
|
|
|
|
2020-11-25 07:32:51 +05:30
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2020-10-20 16:14:31 +05:30
|
|
|
|
2020-11-25 07:32:51 +05:30
|
|
|
#define log_line(...) do { \
|
|
|
|
dprintf(2, __VA_ARGS__); \
|
|
|
|
dprintf(2, "\n"); } while (0)
|
2020-10-20 16:14:31 +05:30
|
|
|
|
2020-11-25 07:32:51 +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
|
|
|
|
2020-11-25 07:32:51 +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
|
|
|
|
|