Arduino LibMAD
All Classes Files Functions Pages
mad_log.h
Go to the documentation of this file.
1 
11 #pragma once
12 
13 // User Settings: Activate/Deactivate logging
14 #ifndef MAD_LOGGING_ACTIVE
15 #define MAD_LOGGING_ACTIVE false
16 #endif
17 #ifndef MAD_LOG_LEVEL
18 #define MAD_LOG_LEVEL Warning
19 #endif
20 
21 // Logging Implementation
22 #if MAD_LOGGING_ACTIVE == true
23 static char log_buffer_mad[512];
24 enum LogLevelMAD {Debug, Info, Warning, Error};
25 static LogLevelMAD minLogLevelMAD = MAD_LOG_LEVEL;
26 // We print the log based on the log level
27 #define LOG(level,...) { if(level>=minLogLevelMAD) { int l = snprintf(log_buffer_mad,512, __VA_ARGS__); Serial.write(log_buffer_mad,l); Serial.println(); } }
28 #else
29 // Remove all log statments from the code
30 #define LOG(Debug, ...)
31 #endif