sbgECom Library  5.2.590-stable
Interface SBG Systems IMU/AHRS/INS
Loading...
Searching...
No Matches
sbgDebug.h
Go to the documentation of this file.
1
35#ifndef SBG_DEBUG_H
36#define SBG_DEBUG_H
37
38// sbgCommonLib headers
39#include <sbgDefines.h>
40
41#ifndef SBG_DEBUG_LOG_CATEGORY
42 #define SBG_DEBUG_LOG_CATEGORY ("None")
43#endif
44
45//----------------------------------------------------------------------//
46//- Errors and warning definitions -//
47//----------------------------------------------------------------------//
48
59
60//----------------------------------------------------------------------//
61//- Errors and warning macros -//
62//----------------------------------------------------------------------//
63
73#define SBG_LOG_ERROR_CALL(errorCode, format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__func__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_ERROR, errorCode, format, ##__VA_ARGS__)
74
75#if SBG_CONFIG_ENABLE_LOG_ERROR == 1
76 #define SBG_LOG_ERROR SBG_LOG_ERROR_CALL
77#else
78 #define SBG_LOG_ERROR(format, ...) ((void)sizeof(SBG_LOG_ERROR_CALL(format, ## __VA_ARGS__), 0))
79#endif
80
90#define SBG_LOG_WARNING_CALL(errorCode, format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__func__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_WARNING, errorCode, format, ##__VA_ARGS__)
91
92#if SBG_CONFIG_ENABLE_LOG_WARNING == 1
93 #define SBG_LOG_WARNING SBG_LOG_WARNING_CALL
94#else
95 #define SBG_LOG_WARNING(format, ...) ((void)sizeof(SBG_LOG_WARNING_CALL(format, ## __VA_ARGS__), 0))
96#endif
97
106#define SBG_LOG_INFO_CALL(format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__func__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_INFO, SBG_NO_ERROR, format, ##__VA_ARGS__)
107
108#if SBG_CONFIG_ENABLE_LOG_INFO == 1
109 #define SBG_LOG_INFO SBG_LOG_INFO_CALL
110#else
111 #define SBG_LOG_INFO(format, ...) ((void)sizeof(SBG_LOG_INFO_CALL(format, ## __VA_ARGS__), 0))
112#endif
113
122#define SBG_LOG_DEBUG_CALL(format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__func__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_DEBUG, SBG_NO_ERROR, format, ##__VA_ARGS__)
123
124#if SBG_CONFIG_ENABLE_LOG_DEBUG == 1
125 #define SBG_LOG_DEBUG SBG_LOG_DEBUG_CALL
126#else
127 #define SBG_LOG_DEBUG(format, ...) ((void)sizeof(SBG_LOG_DEBUG_CALL(format, ## __VA_ARGS__), 0))
128#endif
129
130//----------------------------------------------------------------------//
131//- Inline functions -//
132//----------------------------------------------------------------------//
133
141{
142 const char *pString;
143
144 switch (logType)
145 {
147 pString = "error";
148 break;
150 pString = "warning";
151 break;
153 pString = "info";
154 break;
156 pString = "debug";
157 break;
158 default:
159 pString = "unknown";
160 break;
161 }
162
163 return pString;
164}
165
166//----------------------------------------------------------------------//
167//- Public functions -//
168//----------------------------------------------------------------------//
169
177void sbgDebugHexDump(const char *pPrefix, const void *pBuffer, size_t size);
178
179#endif // SBG_DEBUG_H
void sbgDebugHexDump(const char *pPrefix, const void *pBuffer, size_t size)
_SbgDebugLogType
Definition sbgDebug.h:53
@ SBG_DEBUG_LOG_TYPE_DEBUG
Definition sbgDebug.h:57
@ SBG_DEBUG_LOG_TYPE_ERROR
Definition sbgDebug.h:54
@ SBG_DEBUG_LOG_TYPE_WARNING
Definition sbgDebug.h:55
@ SBG_DEBUG_LOG_TYPE_INFO
Definition sbgDebug.h:56
SBG_INLINE const char * sbgDebugLogTypeToStr(SbgDebugLogType logType)
Definition sbgDebug.h:140
enum _SbgDebugLogType SbgDebugLogType
Header file that contains all common definitions.
#define SBG_INLINE
Definition sbgDefines.h:227