-
Notifications
You must be signed in to change notification settings - Fork 21
/
loggertest.cpp
34 lines (31 loc) · 884 Bytes
/
loggertest.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
// use this done to disable the logger at compile time
//#define SWEET_LOGGER_RELEASE
//
#include <log.hpp>
#include <fstream>
#include <unit.hpp>
#ifdef MAIN
int main(int argc, char *argv[])
#else
UNITTEST(loggertest)
#endif
{
auto logOut = std::make_unique<std::ofstream>("logFile.log",
//auto logOut = std::make_unique<std::ofstream>("/home/burner/storage/logFile.log",
std::ios::app);
sweet::getLoggerDrain().setOutput(std::move(logOut));
sweet::getLoggerDrain().alwaysFlush = true;
std::thread arr[4];
for(int i = 0; i < 4; ++i) {
arr[i] = std::thread([&](int j) {
for(size_t i = 0; i < 100000; ++i) {
sweet::LOG(1)("/home/burner/storage/logFile.log") << " " <<j;
sweet::LOG(128)( "args") << " " <<j;
sweet::LOG(128)("args")<<" "<<"hello"<<std::endl<<"some more "<<j<<std::endl;
}
}, i);
}
for(int i = 0; i < 4; ++i) {
arr[i].join();
}
}