forked from airgradienthq/arduino
[temporary commit]
This commit is contained in:
1 parent
8e032927c6
commit
c1ab99ba8d
201 files changed
+506038
No files matched your search
@@ -0,0 +1,61 @@
|
||||
#include "PrintLog.h"
|
||||
|
||||
/**
|
||||
* @brief Print log info
|
||||
*
|
||||
* @param info Log message
|
||||
*/
|
||||
void PrintLog::logInfo(String &info)
|
||||
{
|
||||
logInfo(info.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Print log info
|
||||
*
|
||||
* @param info Log message
|
||||
*/
|
||||
void PrintLog::logInfo(const char *info)
|
||||
{
|
||||
log.printf("[%s] Info: %s\r\n", tag.c_str(), info);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Print log error
|
||||
*
|
||||
* @param err Log message
|
||||
*/
|
||||
void PrintLog::logError(String &err)
|
||||
{
|
||||
logError(err.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Print log error
|
||||
*
|
||||
* @param err Log message
|
||||
*/
|
||||
void PrintLog::logError(const char *err)
|
||||
{
|
||||
log.printf("[%s] Error: %s\r\n", tag.c_str(), err);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Print log warning
|
||||
*
|
||||
* @param warning Log message
|
||||
*/
|
||||
void PrintLog::logWarning(String &warning)
|
||||
{
|
||||
logWarning(warning.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Print log warning
|
||||
*
|
||||
* @param warning Log message
|
||||
*/
|
||||
void PrintLog::logWarning(const char *warning)
|
||||
{
|
||||
log.printf("[%s] Warning: %s\r\n", tag.c_str(), warning);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef _PRINT_LOG_H_
|
||||
#define _PRINT_LOG_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
class PrintLog
|
||||
{
|
||||
private:
|
||||
Stream &log;
|
||||
String tag;
|
||||
|
||||
public:
|
||||
PrintLog(Stream &log, String tag);
|
||||
~PrintLog();
|
||||
|
||||
void logInfo(String &info);
|
||||
void logInfo(const char* info);
|
||||
void logError(String &err);
|
||||
void logError(const char* err);
|
||||
void logWarning(String &warning);
|
||||
void logWarning(const char* warning);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Construct a new Print Log:: Print Log object
|
||||
*
|
||||
* @param log Log stream
|
||||
* @param tag Tag name
|
||||
*/
|
||||
PrintLog::PrintLog(Stream &log, String tag) : log(log), tag(tag)
|
||||
{
|
||||
}
|
||||
|
||||
PrintLog::~PrintLog()
|
||||
{
|
||||
}
|
||||
|
||||
#endif /** _PRINT_LOG_H_ */
|
||||
Reference in new issue
Block a user