-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
48 lines (40 loc) · 1.36 KB
/
test.cpp
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
#include <thread>
#include <iostream>
#include "logger.h"
// a callable object
class callable
{
public:
void operator()(int x)
{
for (int i = 0; i < x; i++)
{
LOG_DEBUG("debug:{} count{}", "I love you applepurple and gauss and nuonuo!", i);
LOG_INFO("info:{} count{}", "I love you applepurple and gauss and nuonuo!", i);
LOG_ERROR("error:{} count{}", "I love you applepurple and gauss and nuonuo!", i);
}
}
};
int main(int argc, char** argv)
{
//std::thread thread1(callable(), 100000);
//std::thread thread2(callable(), 100000);
std::thread thread1(callable(), 1);
std::thread thread2(callable(), 1);
thread1.join();
thread2.join();
std::string homeDir(getHomeDirectory());
homeDir.append("/logs/rocketmq-cpp/");
std::string fileName = to_string(getpid()) + "_" + "rocketmq-cpp.log";
std::string logFile = homeDir + fileName;
LOG_DEBUG("debug %s, %d", "I love you!", 1000);
LOG_ERROR("error log file:{}", logFile);
LOG_DEBUG("debug log file:{}", logFile);
ALOG_LOGGER.SetErrorLevel();
LOG_ERROR("error log file:{}", logFile);
LOG_DEBUG("debug log file:{}", logFile);
ALOG_LOGGER.SetInfoLevel();
LOG_ERROR("error log file:{}", logFile);
LOG_DEBUG("debug log file:{}", logFile);
return 0;
}