1 /* 2 * Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 #ifndef COMMON_KPRINT_H 13 #define COMMON_KPRINT_H 14 15 #include <lib/printk.h> 16 17 #define WARNING 0 18 #define INFO 1 19 #define DEBUG 2 20 21 /* LOG_LEVEL is INFO by default */ 22 23 #if LOG_LEVEL >= WARNING 24 #define kwarn(fmt, ...) printk("[WARN] file:%s " fmt, __FILE__, ##__VA_ARGS__) 25 #else 26 #define kwarn(fmt, ...) 27 #endif 28 29 #if LOG_LEVEL >= INFO 30 #define kinfo(fmt, ...) printk("[INFO] " fmt, ##__VA_ARGS__) 31 #else 32 #define kinfo(fmt, ...) 33 #endif 34 35 #if LOG_LEVEL >= DEBUG 36 #define kdebug(fmt, ...) printk("[DEBUG] " fmt, ##__VA_ARGS__) 37 #else 38 #define kdebug(fmt, ...) 39 #endif 40 41 #endif /* COMMON_KPRINT_H */