-
Notifications
You must be signed in to change notification settings - Fork 0
/
LogStream.h
39 lines (36 loc) · 986 Bytes
/
LogStream.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
#pragma once
#include "FixedBuffer.h"
#include <string>
#include <algorithm>
#include <cstring>
class LogStream:noncopyable{
public:
typedef FixedBuffer<kSmallBuffer> Buffer;
private:
void staticCheck();
template<typename T>
void formatInteger(T);
template<typename T>
void formatDecimal(T);
Buffer buffer_;
static const int kMaxNumbericSize=32;
public:
LogStream& operator<<(bool);
LogStream& operator<<(short);
LogStream& operator<<(unsigned short);
LogStream& operator<<(int);
LogStream& operator<<(unsigned int);
LogStream& operator<<(long);
LogStream& operator<<(unsigned long);
LogStream& operator<<(long long);
LogStream& operator<<(unsigned long long);
LogStream& operator<<(float);
LogStream& operator<<(double);
LogStream& operator<<(long double);
LogStream& operator<<(char);
LogStream& operator<<(const char*);
LogStream& operator<<(const std::string&);
void append(const char *data,int len);
const Buffer& buffer()const;
void resetBuffer();
};