Arduino LibLAME
All Classes Files Functions Pages
lame_log.h
Go to the documentation of this file.
1
11#pragma once
12#include "liblame/log.h"
13
14// User Settings: Activate/Deactivate logging
15#ifndef LAME_LOGGING_ACTIVE
16#define LAME_LOGGING_ACTIVE true
17#endif
18
19#ifndef LAME_LOG_LEVEL
20#define LAME_LOG_LEVEL Debug
21#endif
22
23// Logging Implementation
24#if LAME_LOGGING_ACTIVE == true
25
26enum LogLevelLame {Debug, Info, Warning, Error};
27static int LOGLEVEL_LAME = Warning;
28
29static const char* levelName(LogLevelLame level) {
30 switch(level){
31 case Debug:
32 return "D";
33 case Info:
34 return "I";
35 case Warning:
36 return "W";
37 case Error:
38 return "E";
39 }
40 return "";
41}
42
43// We print the log based on the log level
44#define LOG_LAME(level,...) { if(level>=LOGLEVEL_LAME) { snprintf(log_msg, MAX_LOG_LEN, __VA_ARGS__); print_log(__FILE__,__LINE__, levelName(level)); } }
45#else
46// Remove all log statments from the code
47#define LOG_LAME(level, ...)
48#endif