-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.h
36 lines (27 loc) · 814 Bytes
/
log.h
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
34
35
36
#ifndef _LOG_H_
#define _LOG_H_
#include "common.h"
#if DEBUG >= 0
#define debug(msg, ...) printf("[debug] %s:%i " msg "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#else
#define debug(msg, ...)
#endif
#if DEBUG >= 0
#define info(msg, ...) printf("[info] " msg "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#else
#define info(msg, ...)
#endif
#if DEBUG >= 0
#define warn(msg, ...) printf("[warn] %s:%i " msg "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#else
#define warn(msg, ...)
#endif
#if DEBUG >= 0
#define error(msg, ...) printf("[error] %s:%i " msg "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#else
#define error(msg, ...)
#endif
#define PANIC_MSG \
" KERNEL PANIC \n"
#define PANIC(msg) { printf(PANIC_MSG "PANIC! %s at %s:%i\n", msg, __FILE__, __LINE__); asm volatile("cli\nhlt"); }
#endif /* include _LOG_H_ */