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
| #ifndef LOGWRITER_H
| #define LOGWRITER_H
|
| #include <time.h>
| #include <string.h>
| #include <list>
| #include <stdlib.h>
| #include <stdio.h>
| #include <stdint.h>
| #include <string>
|
| #include "Mutex/Cond.h"
|
| #define LOGSTR_MAX_LENGTH 512
|
| /**
| * @brief The LogWriter class
| * дÈÕÖ¾Àà ¸ºÔð¶¨Ê±½«ÈÕÖ¾ÐÅϢдÈëÎļþ ²¢¹ÜÀíÈÕÖ¾Îļþ
| */
|
| class LogWriter
| {
| public:
| struct LogInfoNode
| {
| int cameraId;
| uint64_t mCreateTime; //´´½¨µÄʱ¼ä(ÓÃÀ´ÅжϹýÁ˶à¾Ã)
| std::string logStr;
|
| LogInfoNode()
| {
| cameraId = 0;
| // memset(time, 0x0, 32);
| // memset(logStr, 0x0, LOGSTR_MAX_LENGTH);
| }
|
| };
|
| LogWriter();
| ~LogWriter();
|
| void writeLog(int cameraId, const std::string &str);
|
| void run();
|
| private:
| char fileName[20];
|
| char *mTmpBuffer;
|
| void addLogNode(const LogInfoNode &node);
|
| std::list<LogInfoNode> mLogNodeList; //Êý¾Ý¶ÓÁÐ
| Cond *mCondition;
|
| };
|
| #endif // LOGWRITER_H
|
|