-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathLogger.h
60 lines (48 loc) · 1.22 KB
/
Logger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include "UART.h"
//#include "SD.h"
//#include "GPRS.hpp"
//#include "DS3231.h"
static const uint8_t SMALL_STRING = 16;
struct ERROR_NUMBER
{
char name[SMALL_STRING];
char number[SMALL_STRING];
};
class Logger
{
public:
Logger(int level);
static void SetUART(UART *uart);
//static void SetLogFile(String file);
//static void SetRTC(DS3231 *rtc);
//static void SetGSM();
//static void SetErrorNumbers(String* names, String* numbers, int count);
//static int GetErrorNumbersCount();
//static ERROR_NUMBER* GetErrorNumber(int id);
static void SetDebug(bool val);
Logger& operator<<(const char c);
Logger& operator<<(const char* c);
Logger& operator<<(const String s);
Logger& operator<<(const __FlashStringHelper* fsh);
Logger& operator<<(const int i);
Logger& operator<<(const unsigned int i);
Logger& operator<<(const long l);
Logger& operator<<(const unsigned long lu);
Logger& operator<<(const float f);
Logger& operator<<(const double d);
private:
void startLine();
void endLine();
template <class T>
void print(T t);
private:
int m_level;
bool m_lineStart;
};
extern Logger debug;
extern Logger console;
extern Logger status;
extern Logger warning;
extern Logger error;
extern Logger severe;