summaryrefslogtreecommitdiff
path: root/util/cbfstool/console/console.h
blob: e2cf277a209a520a09b18a03c9954b94a9e44642 (plain)
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
/* This file is part of the coreboot project. */
/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef _CBFSTOOL_CONSOLE_H_
#define _CBFSTOOL_CONSOLE_H_

#include <stdio.h>
#include <commonlib/loglevel.h>

/* Message output */
extern int verbose;
#define ERROR(...) { fprintf(stderr, "E: " __VA_ARGS__); }
#define WARN(...) { fprintf(stderr, "W: " __VA_ARGS__); }
#define LOG(...) { fprintf(stderr, __VA_ARGS__); }
#define INFO(...) { if (verbose > 0) fprintf(stderr, "INFO: " __VA_ARGS__); }
#define DEBUG(...) { if (verbose > 1) fprintf(stderr, "DEBUG: " __VA_ARGS__); }


#define printk(lvl, ...) \
	{						\
		if ((lvl) <= BIOS_ERR) {		\
			ERROR(__VA_ARGS__);		\
		} else if ((lvl) <= BIOS_NOTICE) {	\
			WARN(__VA_ARGS__);		\
		} else if ((lvl) <= BIOS_INFO) {	\
			INFO(__VA_ARGS__);		\
		} else if ((lvl) <= BIOS_DEBUG) {	\
			DEBUG(__VA_ARGS__);		\
		}					\
	}

#endif