summaryrefslogtreecommitdiffstats
path: root/src/emu/log.h
blob: 6660c66dab07665024bd39faeab0b71123175e07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#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