sbgDebug.h
Go to the documentation of this file.
1 
23 #ifndef SBG_DEBUG_H
24 #define SBG_DEBUG_H
25 
26 // Local headers
27 #include "sbgDefines.h"
28 
29 #ifndef SBG_DEBUG_LOG_CATEGORY
30  #define SBG_DEBUG_LOG_CATEGORY ("None")
31 #endif
32 
33 //----------------------------------------------------------------------//
34 //- Errors and warning definitions -//
35 //----------------------------------------------------------------------//
36 
40 typedef enum _SbgDebugLogType
41 {
47 
48 //----------------------------------------------------------------------//
49 //- Errors and warning macros -//
50 //----------------------------------------------------------------------//
51 
57 #define SBG_LOG_ERROR_CALL(errorCode, format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__FUNCTION__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_ERROR, errorCode, format, ##__VA_ARGS__)
58 
59 #if SBG_CONFIG_ENABLE_LOG_ERROR == 1
60  #define SBG_LOG_ERROR SBG_LOG_ERROR_CALL
61 #else
62  #define SBG_LOG_ERROR(format, ...) ((void)sizeof(SBG_LOG_ERROR_CALL(format, ## __VA_ARGS__)))
63 #endif
64 
70 #define SBG_LOG_WARNING_CALL(errorCode, format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__FUNCTION__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_WARNING, errorCode, format, ##__VA_ARGS__)
71 
72 #if SBG_CONFIG_ENABLE_LOG_WARNING == 1
73  #define SBG_LOG_WARNING SBG_LOG_WARNING_CALL
74 #else
75  #define SBG_LOG_WARNING(format, ...) ((void)sizeof(SBG_LOG_WARNING_CALL(format, ## __VA_ARGS__)))
76 #endif
77 
82 #define SBG_LOG_INFO_CALL(format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__FUNCTION__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_INFO, SBG_NO_ERROR, format, ##__VA_ARGS__)
83 
84 #if SBG_CONFIG_ENABLE_LOG_INFO == 1
85  #define SBG_LOG_INFO SBG_LOG_INFO_CALL
86 #else
87  #define SBG_LOG_INFO(format, ...) ((void)sizeof(SBG_LOG_INFO_CALL(format, ## __VA_ARGS__)))
88 #endif
89 
94 #define SBG_LOG_DEBUG_CALL(format, ...) sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__FUNCTION__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_DEBUG, SBG_NO_ERROR, format, ##__VA_ARGS__)
95 
96 #if SBG_CONFIG_ENABLE_LOG_DEBUG == 1
97  #define SBG_LOG_DEBUG SBG_LOG_DEBUG_CALL
98 #else
99  #define SBG_LOG_DEBUG(format, ...) ((void)sizeof(SBG_LOG_DEBUG_CALL(format, ## __VA_ARGS__)))
100 #endif
101 
102 //----------------------------------------------------------------------//
103 //- Inline functions -//
104 //----------------------------------------------------------------------//
105 
113 {
114  const char *pString;
115 
116  switch (logType)
117  {
119  pString = "error";
120  break;
122  pString = "warning";
123  break;
125  pString = "info";
126  break;
128  pString = "debug";
129  break;
130  default:
131  pString = "unknown";
132  break;
133  }
134 
135  return pString;
136 }
137 
138 #endif /* SBG_DEBUG_H */
_SbgDebugLogType
Definition: sbgDebug.h:40
#define SBG_INLINE
Definition: sbgDefines.h:186
enum _SbgDebugLogType SbgDebugLogType
SBG_INLINE const char * sbgDebugLogTypeToStr(SbgDebugLogType logType)
Definition: sbgDebug.h:112
Header file that contains all common definitions.


sbg_driver
Author(s): SBG Systems
autogenerated on Sat Sep 3 2022 02:53:35