-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
39 lines (29 loc) · 871 Bytes
/
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
#include <iostream>
#include <hide/Project.h>
#include <hide/utils/ILoggerSink.h>
#include <boost/exception/diagnostic_information.hpp>
#include <chrono>
#include <thread>
class LoggerSink : public virtual hide::ILoggerSink
{
virtual void PrintMessage(const hide::LoggerMessage& msg)
{ printf("%s\n", msg.ToString().c_str()); }
};
int main()
{
try
{
hide::SetCurrentThreadName("main");
hide::ILoggerSinkPtr sink = std::make_shared<LoggerSink>();
hide::Logger::AddSink(sink);
hide::Logger::SetLogLevel(hide::LogLevel::Debug);
hide::ProjectPtr p = hide::Project::CreateAuto({".*\\bCMakeFiles\\b.*", ".*\\.git\\b.*"});
std::this_thread::sleep_for(std::chrono::seconds(10));
p.reset();
hide::Logger::RemoveSink(sink);
}
catch (const std::exception& ex)
{
std::cerr << "test failed: " << boost::diagnostic_information(ex) << std::endl;
}
}