14 #ifndef INCLUDED_SAL_DETAIL_LOG_H
15 #define INCLUDED_SAL_DETAIL_LOG_H
41 #if defined __cplusplus
49 #if defined __cplusplus
50 #define SAL_LOG_TRUE true
51 #define SAL_LOG_FALSE false
53 #define SAL_LOG_TRUE sal_True
54 #define SAL_LOG_FALSE sal_False
57 enum sal_detail_LogLevel {
58 SAL_DETAIL_LOG_LEVEL_INFO, SAL_DETAIL_LOG_LEVEL_WARN,
63 enum sal_detail_LogLevel level,
char const * area,
char const * where,
64 char const * format, ...)
66 __attribute__((format(printf, 4, 5)))
70 #if defined __cplusplus
74 #define SAL_DETAIL_LOG_FORMAT(condition, level, area, where, ...) \
77 sal_detail_logFormat((level), (area), (where), __VA_ARGS__); \
79 } while (SAL_LOG_FALSE)
81 #if defined SAL_LOG_INFO
82 #define SAL_DETAIL_ENABLE_LOG_INFO SAL_LOG_TRUE
84 #define SAL_DETAIL_ENABLE_LOG_INFO SAL_LOG_FALSE
86 #if defined SAL_LOG_WARN
87 #define SAL_DETAIL_ENABLE_LOG_WARN SAL_LOG_TRUE
89 #define SAL_DETAIL_ENABLE_LOG_WARN SAL_LOG_FALSE
92 #define SAL_DETAIL_WHERE __FILE__ ":" SAL_STRINGIFY(__LINE__) ": "
94 #define SAL_DETAIL_INFO_IF_FORMAT(condition, area, ...) \
95 SAL_DETAIL_LOG_FORMAT( \
96 SAL_DETAIL_ENABLE_LOG_INFO && (condition), SAL_DETAIL_LOG_LEVEL_INFO, \
97 area, SAL_DETAIL_WHERE, __VA_ARGS__)
99 #define SAL_DETAIL_WARN_IF_FORMAT(condition, area, ...) \
100 SAL_DETAIL_LOG_FORMAT( \
101 SAL_DETAIL_ENABLE_LOG_WARN && (condition), SAL_DETAIL_LOG_LEVEL_WARN, \
102 area, SAL_DETAIL_WHERE, __VA_ARGS__)
#define SAL_DLLPUBLIC
Definition: saldllapi.h:34
#define SAL_MAX_ENUM
Definition: types.h:205