#ifndef LIBDI_INCLUDE_DI_LOG_MACROS_H_ #define LIBDI_INCLUDE_DI_LOG_MACROS_H_ /* * Preprocessor configured loglevel * by default no log is enabled */ #if defined(DI_LOG_QUIET) /* Quiet */ #elif defined(DI_LOG_ENABLE_FROM_ERROR) # define DI_LOG_ENABLE_CRIT # define DI_LOG_ENABLE_ERROR #elif defined(DI_LOG_ENABLE_FROM_WARN) # define DI_LOG_ENABLE_CRIT # define DI_LOG_ENABLE_ERROR # define DI_LOG_ENABLE_WARN #elif defined(DI_LOG_ENABLE_FROM_INFO) # define DI_LOG_ENABLE_CRIT # define DI_LOG_ENABLE_ERROR # define DI_LOG_ENABLE_WARN # define DI_LOG_ENABLE_INFO #elif defined(DI_LOG_ENABLE_FROM_DEBUG) # define DI_LOG_ENABLE_CRIT # define DI_LOG_ENABLE_ERROR # define DI_LOG_ENABLE_WARN # define DI_LOG_ENABLE_INFO # define DI_LOG_ENABLE_DEBUG #endif /* Crit */ #if defined(DI_LOG_ENABLE_CRIT) #define DI_LOG_CRIT(fmt, ...) \ di_log(DI_LOG_LEVEL_CRIT, DI_LOG_COMPONENT, DI_LOG_MODULE, fmt, ##__VA_ARGS__) #else #define DI_LOG_CRIT(fmt, ...) do {} while (0) #endif /* Error */ #if defined(DI_LOG_ENABLE_ERROR) #define DI_LOG_ERROR(fmt, ...) \ di_log(DI_LOG_LEVEL_ERROR, DI_LOG_COMPONENT, DI_LOG_MODULE, fmt, ##__VA_ARGS__) #else #define DI_LOG_ERROR(fmt, ...) do {} while (0) #endif /* Warn */ #if defined(DI_LOG_ENABLE_WARN) #define DI_LOG_WARN(fmt, ...) \ di_log(DI_LOG_LEVEL_WARN, DI_LOG_COMPONENT, DI_LOG_MODULE, fmt, ##__VA_ARGS__) #else #define DI_LOG_WARN(fmt, ...) do {} while (0) #endif /* Info */ #if defined(DI_LOG_ENABLE_INFO) #define DI_LOG_INFO(fmt, ...) \ di_log(DI_LOG_LEVEL_INFO, DI_LOG_COMPONENT, DI_LOG_MODULE, fmt, ##__VA_ARGS__) #else #define DI_LOG_INFO(fmt, ...) do {} while (0) #endif /* Debug */ #if defined(DI_LOG_ENABLE_DEBUG) #define DI_LOG_DEBUG(fmt, ...) \ di_log(DI_LOG_LEVEL_DEBUG, DI_LOG_COMPONENT, DI_LOG_MODULE, fmt, ##__VA_ARGS__) #else #define DI_LOG_DEBUG(fmt, ...) do {} while (0) #endif #endif /* LIBDI_INCLUDE_DI_LOG_MACROS_H_ */