STM32 Logger
|
Modular and flexible logging system for STM32-based MCU projects. More...
#include <stdint.h>
#include <stdarg.h>
Go to the source code of this file.
Enumerations | |
enum | LogLevel { LOG_LEVEL_ERROR = 0 , LOG_LEVEL_WARN , LOG_LEVEL_INFO , LOG_LEVEL_DEBUG } |
Defines severity levels for logging. More... |
Functions | |
void | Log_Init (void) |
Initialize the logging system. | |
void | Log_SetLevel (LogLevel level) |
Set the active logging level. | |
void | Log (LogLevel level, const char *format,...) |
Log a formatted message if the level passes the threshold. | |
void | Log_Flush (void) |
Flush output buffers. | |
void | Log_Disable (void) |
Disable all logging at runtime. | |
__attribute__ ((weak)) void Log_Write_UART(const char *msg) | |
UART output hook. Can be overridden by user. |
Modular and flexible logging system for STM32-based MCU projects.
enum LogLevel |
__attribute__ | ( | (weak) | ) | const |
UART output hook. Can be overridden by user.
Default SD card log output (weak). Can be overridden for filters, timestamps, or buffering.
SD card output hook. Can be overridden by user.
msg | Null-terminated string to send via UART. |
msg | Null-terminated string to write to file. |
msg | Null-terminated string to append to log file. |
void Log | ( | LogLevel | level, |
const char * | format, | ||
... ) |
Log a formatted message if the level passes the threshold.
level | The severity of the message. |
format | printf-style format string. |
... | Arguments to format. |
Log a formatted message if the level passes the threshold.
level | Severity level (LOG_LEVEL_ERROR, etc.) |
format | printf-style format string. |
... | Arguments to format. |
void Log_Disable | ( | void | ) |
Disable all logging at runtime.
Logging can be re-enabled by calling Log_SetLevel().
Disable all logging at runtime.
void Log_Flush | ( | void | ) |
Flush output buffers.
For SD logging, this calls f_sync() to commit to disk.
Flush output buffers.
void Log_Init | ( | void | ) |
Initialize the logging system.
Sets up buffers, SD card (if enabled), and clears state.
Initialize the logging system.