mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-16 07:23:07 +01:00
use nonblocking write for serial
This commit is contained in:
@@ -1,17 +1,25 @@
|
||||
#ifndef _GWLOG_H
|
||||
#define _GWLOG_H
|
||||
#include <Arduino.h>
|
||||
|
||||
class GwLogWriter{
|
||||
public:
|
||||
virtual ~GwLogWriter(){}
|
||||
virtual void write(const char *data)=0;
|
||||
};
|
||||
class GwLog{
|
||||
private:
|
||||
char buffer[100];
|
||||
bool logSerial=false;
|
||||
int logLevel=1;
|
||||
GwLogWriter *writer;
|
||||
public:
|
||||
static const int LOG=1;
|
||||
static const int ERROR=0;
|
||||
static const int DEBUG=3;
|
||||
static const int TRACE=2;
|
||||
GwLog(bool logSerial,int level=LOG);
|
||||
String prefix="LOG:";
|
||||
GwLog(int level=LOG, GwLogWriter *writer=NULL);
|
||||
void setWriter(GwLogWriter *writer);
|
||||
void logString(const char *fmt,...);
|
||||
void logDebug(int level, const char *fmt,...);
|
||||
int isActive(int level){return level <= logLevel;};
|
||||
|
||||
Reference in New Issue
Block a user