| MIP_SDK
    v4.0.0
    MicroStrain Communications Library for embedded systems | 
Logging functions in C. More...
| Macros | |
| #define | MICROSTRAIN_LOGGING_LEVEL_OFF_ 0 | 
| #define | MICROSTRAIN_LOGGING_LEVEL_FATAL_ 1 | 
| #define | MICROSTRAIN_LOGGING_LEVEL_ERROR_ 2 | 
| #define | MICROSTRAIN_LOGGING_LEVEL_WARN_ 3 | 
| #define | MICROSTRAIN_LOGGING_LEVEL_INFO_ 4 | 
| #define | MICROSTRAIN_LOGGING_LEVEL_DEBUG_ 5 | 
| #define | MICROSTRAIN_LOGGING_LEVEL_TRACE_ 6 | 
| #define | MICROSTRAIN_LOGGING_ENABLED | 
| #define | MICROSTRAIN_LOGGING_ENABLED_FATAL | 
| #define | MICROSTRAIN_LOGGING_ENABLED_ERROR | 
| #define | MICROSTRAIN_LOGGING_ENABLED_WARN | 
| #define | MICROSTRAIN_LOGGING_ENABLED_INFO | 
| #define | MICROSTRAIN_LOGGING_ENABLED_DEBUG | 
| #define | MICROSTRAIN_LOGGING_ENABLED_TRACE | 
| #define | MICROSTRAIN_LOG_INIT(callback, level, user) microstrain_logging_init(callback, level, user) | 
| 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, ...) microstrain_logging_log(level, __VA_ARGS__) | 
| 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_LOG_LOG_V(level, fmt, args) microstrain_logging_log_v(level, fmt, args) | 
| #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_FATAL_V(fmt, args) MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_FATAL, fmt, args) | 
| #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_ERROR_V(fmt, args) MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_ERROR, fmt, args) | 
| #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_WARN_V(fmt, args) MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_WARN, fmt, args) | 
| #define | MICROSTRAIN_LOG_INFO(...) MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_INFO, __VA_ARGS__) | 
| Helper macro used to log data inside the MicroStrain SDK at info level.  More... | |
| #define | MICROSTRAIN_LOG_INFO_V(fmt, args) MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_INFO, fmt, args) | 
| #define | MICROSTRAIN_LOG_DEBUG(...) MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_DEBUG, __VA_ARGS__) | 
| Helper macro used to log data inside the MicroStrain SDK at debug level.  More... | |
| #define | MICROSTRAIN_LOG_DEBUG_V(fmt, args) MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_DEBUG, fmt, args) | 
| #define | MICROSTRAIN_LOG_TRACE(...) MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_TRACE, __VA_ARGS__) | 
| Helper macro used to log data inside the MicroStrain SDK at trace level.  More... | |
| #define | MICROSTRAIN_LOG_TRACE_V(fmt, args) MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_TRACE, fmt, args) | 
| #define | MICROSTRAIN_LOG_BYTES(level, msg, data, length) microstrain_log_bytes(level, msg, data, length) | 
| Helper macro used to log bytes as a hex sting.  More... | |
| #define | MICROSTRAIN_LOG_BYTES_TRACE(msg, data, length) microstrain_log_bytes(MICROSTRAIN_LOG_LEVEL_TRACE, msg, data, length) | 
| Helper macro used to log bytes as a hex sting at trace level.  More... | |
| #define | MICROSTRAIN_LOG_ERROR_WITH_ERRNO(msg) MICROSTRAIN_LOG_ERROR(msg ": %d %s\n", errno, strerror(errno)) | 
| Helper macro used to log an error message from a syscall.  More... | |
| #define | MICROSTRAIN_LOG_ERROR_WITH_ERRNO_EX(msg, ...) MICROSTRAIN_LOG_ERROR(msg ": %d %s\n", __VA_ARGS__, errno, strerror(errno)) | 
| Helper macro used to log an error message from a syscall.  More... | |
| Typedefs | |
| typedef enum microstrain_log_level | microstrain_log_level | 
| Logging level enum.  More... | |
| typedef void(* | microstrain_log_callback) (void *user, const microstrain_log_level level, const char *fmt, va_list args) | 
| Callback function typedef for custom logging behavior.  More... | |
| Enumerations | |
| enum | microstrain_log_level { MICROSTRAIN_LOG_LEVEL_OFF = MICROSTRAIN_LOGGING_LEVEL_OFF_, MICROSTRAIN_LOG_LEVEL_FATAL = MICROSTRAIN_LOGGING_LEVEL_FATAL_, MICROSTRAIN_LOG_LEVEL_ERROR = MICROSTRAIN_LOGGING_LEVEL_ERROR_, MICROSTRAIN_LOG_LEVEL_WARN = MICROSTRAIN_LOGGING_LEVEL_WARN_, MICROSTRAIN_LOG_LEVEL_INFO = MICROSTRAIN_LOGGING_LEVEL_INFO_, MICROSTRAIN_LOG_LEVEL_DEBUG = MICROSTRAIN_LOGGING_LEVEL_DEBUG_, MICROSTRAIN_LOG_LEVEL_TRACE = MICROSTRAIN_LOGGING_LEVEL_TRACE_ } | 
| Logging level enum.  More... | |
| Functions | |
| static void | microstrain_log_unused_v (const char *fmt,...) | 
| void | microstrain_logging_init (const microstrain_log_callback callback, const 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_v (const microstrain_log_level level, const char *fmt, va_list args) | 
| Internal log function called by variadic logging macros. Call MICROSTRAIN_LOG_*_V macros instead of using this function directly.  More... | |
| void | microstrain_logging_log (const 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... | |
| const char * | microstrain_logging_level_name (const microstrain_log_level level) | 
| Returns a string representing the given log level.  More... | |
| void | microstrain_log_bytes (const microstrain_log_level level, const char *msg, const uint8_t *data, size_t length) | 
| Print bytes in hex to the log.  More... | |
| #define MICROSTRAIN_LOGGING_LEVEL_OFF_ 0 | 
| #define MICROSTRAIN_LOGGING_LEVEL_FATAL_ 1 | 
| #define MICROSTRAIN_LOGGING_LEVEL_ERROR_ 2 | 
| #define MICROSTRAIN_LOGGING_LEVEL_WARN_ 3 | 
| #define MICROSTRAIN_LOGGING_LEVEL_INFO_ 4 | 
| #define MICROSTRAIN_LOGGING_LEVEL_DEBUG_ 5 | 
| #define MICROSTRAIN_LOGGING_LEVEL_TRACE_ 6 | 
| #define MICROSTRAIN_LOGGING_ENABLED | 
| #define MICROSTRAIN_LOGGING_ENABLED_FATAL | 
| #define MICROSTRAIN_LOGGING_ENABLED_ERROR | 
| #define MICROSTRAIN_LOGGING_ENABLED_WARN | 
| #define MICROSTRAIN_LOGGING_ENABLED_INFO | 
| #define MICROSTRAIN_LOGGING_ENABLED_DEBUG | 
| #define MICROSTRAIN_LOGGING_ENABLED_TRACE | 
| #define MICROSTRAIN_LOG_INIT | ( | callback, | |
| level, | |||
| user | |||
| ) | microstrain_logging_init(callback, level, user) | 
| callback | The callback to execute when there is data to log | 
| level | The level that the MicroStrain SDK should log at | 
| user | User data that will be passed to the callback every time it is executed | 
| #define MICROSTRAIN_LOG_LOG | ( | level, | |
| ... | |||
| ) | microstrain_logging_log(level, __VA_ARGS__) | 
| user | User data pointer | 
| level | The log level that this log should be logged at | 
| fmt | printf style format string | 
| args | Variadic args used to populate the fmt string | 
| #define MICROSTRAIN_LOG_LOG_V | ( | level, | |
| fmt, | |||
| args | |||
| ) | microstrain_logging_log_v(level, fmt, args) | 
| #define MICROSTRAIN_LOG_FATAL | ( | ... | ) | MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_FATAL, __VA_ARGS__) | 
| context | Context of what called this function. Could be a mip device, serial connection, etc. | 
| fmt | printf style format string | 
| ... | Variadic args used to populate the fmt string | 
| #define MICROSTRAIN_LOG_FATAL_V | ( | fmt, | |
| args | |||
| ) | MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_FATAL, fmt, args) | 
| #define MICROSTRAIN_LOG_ERROR | ( | ... | ) | MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_ERROR, __VA_ARGS__) | 
| context | Context of what called this function. Could be a mip device, serial connection, etc. | 
| fmt | printf style format string | 
| ... | Variadic args used to populate the fmt string | 
| #define MICROSTRAIN_LOG_ERROR_V | ( | fmt, | |
| args | |||
| ) | MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_ERROR, fmt, args) | 
| #define MICROSTRAIN_LOG_WARN | ( | ... | ) | MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_WARN, __VA_ARGS__) | 
| context | Context of what called this function. Could be a mip device, serial connection, etc. | 
| fmt | printf style format string | 
| ... | Variadic args used to populate the fmt string | 
| #define MICROSTRAIN_LOG_WARN_V | ( | fmt, | |
| args | |||
| ) | MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_WARN, fmt, args) | 
| #define MICROSTRAIN_LOG_INFO | ( | ... | ) | MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_INFO, __VA_ARGS__) | 
| context | Context of what called this function. Could be a mip device, serial connection, etc. | 
| fmt | printf style format string | 
| ... | Variadic args used to populate the fmt string | 
| #define MICROSTRAIN_LOG_INFO_V | ( | fmt, | |
| args | |||
| ) | MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_INFO, fmt, args) | 
| #define MICROSTRAIN_LOG_DEBUG | ( | ... | ) | MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_DEBUG, __VA_ARGS__) | 
| context | Context of what called this function. Could be a mip device, serial connection, etc. | 
| fmt | printf style format string | 
| ... | Variadic args used to populate the fmt string | 
| #define MICROSTRAIN_LOG_DEBUG_V | ( | fmt, | |
| args | |||
| ) | MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_DEBUG, fmt, args) | 
| #define MICROSTRAIN_LOG_TRACE | ( | ... | ) | MICROSTRAIN_LOG_LOG(MICROSTRAIN_LOG_LEVEL_TRACE, __VA_ARGS__) | 
| context | Context of what called this function. Could be a mip device, serial connection, etc. | 
| fmt | printf style format string | 
| ... | Variadic args used to populate the fmt string | 
| #define MICROSTRAIN_LOG_TRACE_V | ( | fmt, | |
| args | |||
| ) | MICROSTRAIN_LOG_LOG_V(MICROSTRAIN_LOG_LEVEL_TRACE, fmt, args) | 
| #define MICROSTRAIN_LOG_BYTES | ( | level, | |
| msg, | |||
| data, | |||
| length | |||
| ) | microstrain_log_bytes(level, msg, data, length) | 
| #define MICROSTRAIN_LOG_BYTES_TRACE | ( | msg, | |
| data, | |||
| length | |||
| ) | microstrain_log_bytes(MICROSTRAIN_LOG_LEVEL_TRACE, msg, data, length) | 
This optimizes out to a NO-OP when MICROSTRAIN_LOGGING_ENABLED_TRACE is not defined.
| #define MICROSTRAIN_LOG_ERROR_WITH_ERRNO | ( | msg | ) | MICROSTRAIN_LOG_ERROR(msg ": %d %s\n", errno, strerror(errno)) | 
| msg | A plain C-string without any printf-style formatters. The resulting log message will be "<message here>: <error-code> <error-description>\n". | 
| #define MICROSTRAIN_LOG_ERROR_WITH_ERRNO_EX | ( | msg, | |
| ... | |||
| ) | MICROSTRAIN_LOG_ERROR(msg ": %d %s\n", __VA_ARGS__, errno, strerror(errno)) | 
| msg | A plain C-string which includes one or more printf-style formatters. | 
| ... | Arguments corresponding to the format codes in msg. The resulting log message will be "<message here>: <error-code> <error-description>\n". | 
| typedef enum microstrain_log_level microstrain_log_level | 
| typedef void(* microstrain_log_callback) (void *user, const microstrain_log_level level, const char *fmt, va_list args) | 
| user | User data pointer | 
| level | The log level that this log should be logged at | 
| fmt | printf style format string | 
| args | Variadic args used to populate the fmt string | 
| 
 | inlinestatic | 
| void microstrain_logging_init | ( | const microstrain_log_callback | callback, | 
| const microstrain_log_level | level, | ||
| void * | user | ||
| ) | 
| callback | The callback to execute when there is data to log | 
| level | The level that the MicroStrain SDK should log at | 
| user | User data that will be passed to the callback every time it is executed | 
| microstrain_log_callback microstrain_logging_callback | ( | void | ) | 
| microstrain_log_level microstrain_logging_level | ( | void | ) | 
| void* microstrain_logging_user_data | ( | void | ) | 
| void microstrain_logging_log_v | ( | const microstrain_log_level | level, | 
| const char * | fmt, | ||
| va_list | args | ||
| ) | 
| user | User data pointer | 
| level | The log level that this log should be logged at | 
| fmt | printf style format string | 
| args | Variadic args used to populate the fmt string | 
| void microstrain_logging_log | ( | const microstrain_log_level | level, | 
| const char * | fmt, | ||
| ... | |||
| ) | 
| user | User data pointer | 
| level | The log level that this log should be logged at | 
| fmt | printf style format string | 
| args | Variadic args used to populate the fmt string | 
| const char* microstrain_logging_level_name | ( | const microstrain_log_level | level | ) | 
| level | The returned string is statically-allocated and shall not be freed nor modified. The strings are padded to a uniform length for consistent alignment in log files. | 
| void microstrain_log_bytes | ( | const microstrain_log_level | level, | 
| const char * | msg, | ||
| const uint8_t * | data, | ||
| size_t | length | ||
| ) | 
| level | Logging level. This function does nothing unless the current log level is at least this value. | 
| msg | Message to print immediately before the data. No space is appended. Use an empty string to print just the data. | 
| data | Data to be printed in hex. | 
| length | Length of the data to print. | 
 1.8.17
 1.8.17