sbgECom Library  4.0.1987-stable
C library to interface SBG Systems IMU/AHRS/INS
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, ...)   sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__func__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_ERROR, errorCode, format, ##__VA_ARGS__)
 
#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__)
 
#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__)
 
#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__)
 

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,
  ... 
)    sbgPlatformDebugLogMsg((const char*)__BASE_FILE__, (const char*)__func__, __LINE__, SBG_DEBUG_LOG_CATEGORY, SBG_DEBUG_LOG_TYPE_ERROR, errorCode, format, ##__VA_ARGS__)

Log an error with its associated message.

Parameters
[in]errorCodeThe error code that has thrown this error.
[in]formatString litteral for the associated error message (you can use printf like string formating).

◆ SBG_LOG_WARNING_CALL

#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__)

Log a warning with its associated message.

Parameters
[in]errorCodeThe error code that has thrown this warning.
[in]formatString litteral for the associated warning message (you can use printf like string formating).

◆ SBG_LOG_INFO_CALL

#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__)

Log an information message.

Parameters
[in]formatString litteral for the information message (you can use printf like string formating).

◆ SBG_LOG_DEBUG_CALL

#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__)

Log an information message only in debug mode

Parameters
[in]formatString litteral for the information message (you can use printf like string formating).

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, and SBG_DEBUG_LOG_TYPE_WARNING.

◆ 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.