sbgECom Library  5.2.590-stable
Interface SBG Systems IMU/AHRS/INS
Loading...
Searching...
No Matches
sbgDebug.h File Reference

Define and handle error logging for the SBG Systems common C library. More...

#include <sbgDefines.h>

Go to the source code of this file.

Macros

#define SBG_LOG_ERROR_CALL(errorCode, format, ...)
 Log an error with its associated message.
 
#define SBG_LOG_WARNING_CALL(errorCode, format, ...)
 Log a warning with its associated message.
 
#define SBG_LOG_INFO_CALL(format, ...)
 Log an information message.
 
#define SBG_LOG_DEBUG_CALL(format, ...)
 Log a a debug message.
 

Typedefs

typedef enum _SbgDebugLogType SbgDebugLogType
 

Enumerations

enum  _SbgDebugLogType {
  SBG_DEBUG_LOG_TYPE_ERROR ,
  SBG_DEBUG_LOG_TYPE_WARNING ,
  SBG_DEBUG_LOG_TYPE_INFO ,
  SBG_DEBUG_LOG_TYPE_DEBUG
}
 

Functions

SBG_INLINE const char * sbgDebugLogTypeToStr (SbgDebugLogType logType)
 
void sbgDebugHexDump (const char *pPrefix, const void *pBuffer, size_t size)
 

Detailed Description

Define and handle error logging for the SBG Systems common C library.

Author
SBG Systems
Date
17 March 2015

The methods defined here should be implemented in sbgPlatform.h/sbgPlatform.c according to your platform and needs.

License

The MIT license

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Macro Definition Documentation

◆ SBG_LOG_ERROR_CALL

#define SBG_LOG_ERROR_CALL ( errorCode,
format,
... )
Value:
sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__func__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_ERROR, errorCode, format, ##__VA_ARGS__)
@ SBG_DEBUG_LOG_TYPE_ERROR
Definition sbgDebug.h:54
#define __BASE_FILE__
Definition sbgDefines.h:200
SBG_COMMON_LIB_API void sbgPlatformDebugLogMsg(const char *pFileName, const char *pFunctionName, uint32_t line, const char *pCategory, SbgDebugLogType logType, SbgErrorCode errorCode, const char *pFormat,...) SBG_CHECK_FORMAT(printf

Log an error with its associated message.

This macro logs an error message along with the specified error code. The message can include formatted text similar to printf.

Parameters
[in]errorCodeThe error code that triggered this error.
[in]formatThe string literal for the associated error message, supporting printf-like formatting.
[in]...Additional arguments for the format string.

◆ SBG_LOG_WARNING_CALL

#define SBG_LOG_WARNING_CALL ( errorCode,
format,
... )
Value:
sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__func__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_WARNING, errorCode, format, ##__VA_ARGS__)
@ SBG_DEBUG_LOG_TYPE_WARNING
Definition sbgDebug.h:55

Log a warning with its associated message.

This macro logs a warning message along with the specified error code. The message can include formatted text similar to printf.

Parameters
[in]errorCodeThe error code that triggered this warning.
[in]formatThe string literal for the associated error message, supporting printf-like formatting.
[in]...Additional arguments for the format string.

◆ SBG_LOG_INFO_CALL

#define SBG_LOG_INFO_CALL ( format,
... )
Value:
sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__func__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_INFO, SBG_NO_ERROR, format, ##__VA_ARGS__)
@ SBG_DEBUG_LOG_TYPE_INFO
Definition sbgDebug.h:56
@ SBG_NO_ERROR
Definition sbgErrorCodes.h:52

Log an information message.

This macro logs an information message. The message can include formatted text similar to printf.

Parameters
[in]formatThe string literal for the associated information message, supporting printf-like formatting.
[in]...Additional arguments for the format string.

◆ SBG_LOG_DEBUG_CALL

#define SBG_LOG_DEBUG_CALL ( format,
... )
Value:
sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__func__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_DEBUG, SBG_NO_ERROR, format, ##__VA_ARGS__)
@ SBG_DEBUG_LOG_TYPE_DEBUG
Definition sbgDebug.h:57

Log a a debug message.

This macro logs a debug message, which is only output when compiled in debug mode. The message can include formatted text similar to printf.

Parameters
[in]formatThe string literal for the associated debug message, supporting printf-like formatting.
[in]...Additional arguments for the format string.

Typedef Documentation

◆ SbgDebugLogType

Enum that identify the type of error / warning that has been thrown.

Enumeration Type Documentation

◆ _SbgDebugLogType

Enum that identify the type of error / warning that has been thrown.

Enumerator
SBG_DEBUG_LOG_TYPE_ERROR 

The message to log is an error.

SBG_DEBUG_LOG_TYPE_WARNING 

The message to log is a warning.

SBG_DEBUG_LOG_TYPE_INFO 

The message to log is an information.

SBG_DEBUG_LOG_TYPE_DEBUG 

The message to log is a debug information.

Function Documentation

◆ sbgDebugLogTypeToStr()

SBG_INLINE const char * sbgDebugLogTypeToStr ( SbgDebugLogType logType)

Convert a log type into a string representation.

Parameters
[in]logTypeLog type.
Returns
String representation for the given log type.

References SBG_DEBUG_LOG_TYPE_DEBUG, SBG_DEBUG_LOG_TYPE_ERROR, SBG_DEBUG_LOG_TYPE_INFO, SBG_DEBUG_LOG_TYPE_WARNING, and SBG_INLINE.

◆ sbgDebugHexDump()

void sbgDebugHexDump ( const char * pPrefix,
const void * pBuffer,
size_t size )

Produce a text dump of a buffer.

Parameters
[in]pPrefixPrefix string before each line.
[in]pBufferData buffer, may be NULL.
[in]sizeData size, in bytes.