summaryrefslogblamecommitdiffstats
path: root/src/emu/log.h
blob: 6660c66dab07665024bd39faeab0b71123175e07 (plain) (tree)
































                                               
#ifndef _LOG_H
#define _LOG_H

#include <stdbool.h>
#include <stdio.h>

extern bool is_debug;

#define debug(...) do { \
	if (is_debug) { \
		fprintf(stderr, __VA_ARGS__); \
		fprintf(stderr, "\n"); \
	} \
} while (0)

#define error(...) do { \
	fprintf(stderr, __VA_ARGS__); \
	fprintf(stderr, "\n"); \
} while (0)

#define die(...) do { \
	error(__VA_ARGS__); \
	exit(EXIT_FAILURE); \
} while (0)

#define pdie(...) do { \
	fprintf(stderr, __VA_ARGS__); \
	fprintf(stderr, ": "); \
	perror(NULL); \
	exit(EXIT_FAILURE); \
} while (0)

#endif