MIP_SDK  latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
Macros | Typedefs | Functions
logging.h File Reference
#include <stdint.h>
#include <stdarg.h>

Go to the source code of this file.

Macros

#define MICROSTRAIN_LOG_LEVEL_OFF   0
 Signifies that the log is turned off. More...
 
#define MICROSTRAIN_LOG_LEVEL_FATAL   1
 Fatal logs are logged when an unrecoverable error occurs. More...
 
#define MICROSTRAIN_LOG_LEVEL_ERROR   2
 Error logs are logged when an error occurs. More...
 
#define MICROSTRAIN_LOG_LEVEL_WARN   3
 Warning logs are logged when something concerning happens that may or not be a mistake. More...
 
#define MICROSTRAIN_LOG_LEVEL_INFO   4
 Info logs are logged when some general info needs to be conveyed to the user. More...
 
#define MICROSTRAIN_LOG_LEVEL_DEBUG   5
 Debug logs are logged for debug purposes. More...
 
#define MICROSTRAIN_LOG_LEVEL_TRACE   6
 Trace logs are logged in similar cases to debug logs but can be logged in tight loops. More...
 
#define MICROSTRAIN_LOG_INIT(callback, level, user)   (void)0
 Helper macro used to initialize the MicroStrain logger. This function does not need to be called unless the user wants logging. More...
 
#define MICROSTRAIN_LOG_LOG(level, ...)   (void)0
 Helper macro used to log data inside the MicroStrain SDK. Prefer specific log level functions like MICROSTRAIN_LOG_INFO, etc. when possible. More...
 
#define MICROSTRAIN_LOGGING_MAX_LEVEL   MICROSTRAIN_LOG_LEVEL_WARN
 
#define MICROSTRAIN_LOG_FATAL(...)   MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_FATAL, __VA_ARGS__)
 Helper macro used to log data inside the MicroStrain SDK at fatal level. More...
 
#define MICROSTRAIN_LOG_ERROR(...)   MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_ERROR, __VA_ARGS__)
 Helper macro used to log data inside the MicroStrain SDK at error level. More...
 
#define MICROSTRAIN_LOG_WARN(...)   MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_WARN, __VA_ARGS__)
 Helper macro used to log data inside the MicroStrain SDK at warn level. More...
 
#define MICROSTRAIN_LOG_INFO(...)   (void)0
 Helper macro used to log data inside the MicroStrain SDK at info level. More...
 
#define MICROSTRAIN_LOG_DEBUG(...)   (void)0
 Helper macro used to log data inside the MicroStrain SDK at debug level. More...
 
#define MICROSTRAIN_LOG_TRACE(...)   (void)0
 Helper macro used to log data inside the MicroStrain SDK at trace level. More...
 

Typedefs

typedef uint8_t microstrain_log_level
 Logging level enum. More...
 
typedef void(* microstrain_log_callback) (void *user, microstrain_log_level level, const char *fmt, va_list args)
 Callback function typedef for custom logging behavior. More...
 

Functions

void microstrain_logging_init (microstrain_log_callback callback, microstrain_log_level level, void *user)
 Initializes the logger with a callback and user data. Call MICROSTRAIN_LOG_INIT instead of using this function directly. This function does not have to be called unless the user wants logging. More...
 
microstrain_log_callback microstrain_logging_callback (void)
 Gets the currently active logging callback. More...
 
microstrain_log_level microstrain_logging_level (void)
 Gets the currently active logging level. More...
 
void * microstrain_logging_user_data (void)
 Gets the currently active logging user data. More...
 
void microstrain_logging_log (microstrain_log_level level, const char *fmt,...)
 Internal log function called by logging macros. Call MICROSTRAIN_LOG_* macros instead of using this function directly. More...