1 /* 2 * Copyright 2019, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Augustin Cavalier <waddlesplash> 7 */ 8 #ifndef __NVME_LOG_H__ 9 #define __NVME_LOG_H__ 10 11 #include <stdint.h> 12 #include <stdarg.h> 13 14 15 void nvme_log(enum nvme_log_level level, const char *format, ...) 16 __attribute__((format(printf, 2, 3))); 17 void nvme_vlog(enum nvme_log_level level, const char *format, va_list ap) 18 __attribute__((format(printf,2,0))); 19 20 21 #define nvme_emerg(format, args...) \ 22 nvme_log(NVME_LOG_EMERG, \ 23 "libnvme (FATAL): " format, \ 24 ## args) 25 26 #define nvme_alert(format, args...) \ 27 nvme_log(NVME_LOG_ALERT, \ 28 "libnvme (ALERT): " format, \ 29 ## args) 30 31 #define nvme_crit(format, args...) \ 32 nvme_log(NVME_LOG_CRIT, \ 33 "libnvme (CRITICAL): " format, \ 34 ## args) 35 36 #define nvme_err(format, args...) \ 37 nvme_log(NVME_LOG_ERR, \ 38 "libnvme (ERROR): " format, \ 39 ## args) 40 41 #define nvme_warning(format, args...) \ 42 nvme_log(NVME_LOG_WARNING, \ 43 "libnvme (WARNING): " format, \ 44 ## args) 45 46 #ifdef TRACE_NVME 47 #define nvme_notice(format, args...) \ 48 nvme_log(NVME_LOG_NOTICE, \ 49 "libnvme: " format, \ 50 ## args) 51 52 #define nvme_info(format, args...) \ 53 nvme_log(NVME_LOG_INFO, \ 54 "libnvme: " format, \ 55 ## args) 56 57 #define nvme_debug(format, args...) \ 58 nvme_log(NVME_LOG_DEBUG, \ 59 "libnvme: " format, \ 60 ## args) 61 #else 62 #define nvme_notice(format, args...) 63 #define nvme_info(format, args...) 64 #define nvme_debug(format, args...) 65 #endif 66 67 68 #endif /* __NVME_LOG_H__ */ 69