forked from dersimn/ArduinoUnifiedLog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrettyGenericLog.h
More file actions
49 lines (41 loc) · 1.39 KB
/
PrettyGenericLog.h
File metadata and controls
49 lines (41 loc) · 1.39 KB
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
#pragma once
#include "LogHandler.h"
#include "LogLevels.h"
class PrettyGenericLogCriticalSection {
public:
PrettyGenericLogCriticalSection();
~PrettyGenericLogCriticalSection();
private:
static long refCount;
};
class PrettyGenericLog {
protected:
LogHandler& logHandler;
static bool fmtBufAvailable() { return fmtBuf && fmtBufSize; }
public:
PrettyGenericLog(LogHandler& handler);
virtual void level(int logLevel, String message);
void trace(String message);
void trace(const char * fmt, ...);
void debug(String message);
void debug(const char * fmt, ...);
void info(String message);
void info(const char * fmt, ...);
void warn(String message);
void warn(const char * fmt, ...);
void error(String message);
void error(const char * fmt, ...);
void operator()(int logLevel, String message);
void operator()(int logLevel, const char* fmt, ...);
void operator()(String message);
virtual ~PrettyGenericLog();
static const char* nameForLogLevel(int level);
static bool setBufferSize(size_t size);
static String formatString(const char * fmt, ...);
static String formatString(const char* fmt, va_list args);
static String formatStringWithBuf(char* buf, const size_t bufSize, const char * fmt, ...);
static String formatStringWithBuf(char* buf, const size_t bufSize, const char* fmt, va_list args);
private:
static char* fmtBuf;
static size_t fmtBufSize;
};