10 #ifndef INCLUDED_SAL_DETAIL_LOG_H
11 #define INCLUDED_SAL_DETAIL_LOG_H
37 #if defined __cplusplus
45 #if defined __cplusplus
46 #define SAL_LOG_TRUE true
47 #define SAL_LOG_FALSE false
49 #define SAL_LOG_TRUE sal_True
50 #define SAL_LOG_FALSE sal_False
53 enum sal_detail_LogLevel {
54 SAL_DETAIL_LOG_LEVEL_INFO, SAL_DETAIL_LOG_LEVEL_WARN,
60 enum sal_detail_LogLevel level,
char const * area,
char const * where,
61 char const * format, ...)
63 __attribute__((format(printf, 4, 5)))
67 #if defined __cplusplus
71 #define SAL_DETAIL_LOG_FORMAT(condition, level, area, where, ...) \
74 sal_detail_logFormat((level), (area), (where), __VA_ARGS__); \
76 } while (SAL_LOG_FALSE)
78 #if defined SAL_LOG_INFO
79 #define SAL_DETAIL_ENABLE_LOG_INFO SAL_LOG_TRUE
81 #define SAL_DETAIL_ENABLE_LOG_INFO SAL_LOG_FALSE
83 #if defined SAL_LOG_WARN
84 #define SAL_DETAIL_ENABLE_LOG_WARN SAL_LOG_TRUE
86 #define SAL_DETAIL_ENABLE_LOG_WARN SAL_LOG_FALSE
89 #define SAL_DETAIL_WHERE __FILE__ ":" SAL_STRINGIFY(__LINE__) ": "
91 #define SAL_DETAIL_INFO_IF_FORMAT(condition, area, ...) \
92 SAL_DETAIL_LOG_FORMAT( \
93 SAL_DETAIL_ENABLE_LOG_INFO && (condition), SAL_DETAIL_LOG_LEVEL_INFO, \
94 area, SAL_DETAIL_WHERE, __VA_ARGS__)
96 #define SAL_DETAIL_WARN_IF_FORMAT(condition, area, ...) \
97 SAL_DETAIL_LOG_FORMAT( \
98 SAL_DETAIL_ENABLE_LOG_WARN && (condition), SAL_DETAIL_LOG_LEVEL_WARN, \
99 area, SAL_DETAIL_WHERE, __VA_ARGS__)
#define SAL_DLLPUBLIC
Definition: saldllapi.h:30
#define SAL_MAX_ENUM
Definition: types.h:242