-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCLog.h
60 lines (43 loc) · 1.24 KB
/
CLog.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 <string>
class CLog final {
public:
~CLog() noexcept;
CLog();
void Out() const noexcept;
template <class Head, class... Tail>
void Log(Head&& head, Tail&&... tail) noexcept
{
Put(head); Put();
return Log(std::forward<Tail>(tail)...);
}
private:
void Tail(int s) noexcept;
char* Tail() const noexcept;
void Put() noexcept;
void Put(bool v) noexcept;
void Put(int8_t v) noexcept;
void Put(int16_t v) noexcept;
void Put(int32_t v) noexcept;
void Put(int64_t v) noexcept;
void Put(uint8_t v) noexcept;
void Put(uint16_t v) noexcept;
void Put(uint32_t v) noexcept;
void Put(uint64_t v) noexcept;
void Put(float v) noexcept;
void Put(double v) noexcept;
void Put(const char* v) noexcept;
void Put(const void* v) noexcept;
void Put(const std::string& v) noexcept;
void Log() noexcept;
private:
char maChar[4096];
char* mpTail;
};
template <class... Args>
void clog(Args... args) noexcept
{
CLog v;
v.Log(args...);
v.Out();
}