5#include "VS1053Config.h"
10namespace arduino_vs1053 {
12enum VS1053LogLevel_t { VS1053Debug, VS1053Info, VS1053Warning, VS1053Error };
21 VS1053LogLevel_t logLevel = VS1053Warning;
24 bool begin(VS1053LogLevel_t l, Print &out) {
31 void log(VS1053LogLevel_t level,
const char *fmt...) {
32 if (logLevel <= level) {
34 strcpy(log_buffer, VS1053_log_msg[level]);
35 strcat(log_buffer,
": ");
38 vsprintf(log_buffer + 9, fmt, arg);
40 p_out->println(log_buffer);
46 const char *VS1053_log_msg[4] = {
"Debug",
"Info",
"Warning",
"Error"};
47 Print *p_out = &VS1053_LOG_PORT;
50extern VS1053LoggerClass VS1053Logger;
52#define VS1053_LOGD(fmt, ...) VS1053Logger.log(VS1053Debug, fmt, ##__VA_ARGS__)
53#define VS1053_LOGI(fmt, ...) VS1053Logger.log(VS1053Info, fmt, ##__VA_ARGS__)
54#define VS1053_LOGW(fmt, ...) VS1053Logger.log(VS1053Warning, fmt, ##__VA_ARGS__)
55#define VS1053_LOGE(fmt, ...) VS1053Logger.log(VS1053Error, fmt, ##__VA_ARGS__)
Logging class which supports multiple log levels.
Definition: VS1053Logger.h:18
bool begin(VS1053LogLevel_t l, Print &out)
start the logger
Definition: VS1053Logger.h:24
void log(VS1053LogLevel_t level, const char *fmt...)
Print log message.
Definition: VS1053Logger.h:31