Log a printf-style string in a slog2 buffer
#include <slog2.h>
int slog2fa( slog2_buffer_t buffer,
uint16_t code,
uint8_t severity,
const char* format, ... );
For more information, see the entry for slog2_register().
The slog2fa() function a printf-style format string along with its arguments specified in the argument vector. This function uses special formatting macros to ensure that va_args() doesn't trigger any interrupts. The format string isn't decoded before writing; it must be decoded during the time of the read.
You can use the following macros to build the parameters to slog2fa:
For example:
int8_t some_number = -1;
slog2fa( ..., "string:%s, some_number:%d", SLOG2_FA_STRING( "Hello world" ),
SLOG2_FA_SIGNED( some_number ),
SLOG2_FA_END );
0 on success, or -1 if an error occurred.
See slog2_register().
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | Read the Caveats |
| Signal handler | Yes |
| Thread | Yes |
Don't use double or float arguments in an interrupt handler, unless your code is compiled to use software floating-point emulation.