-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathInterpreter.cpp
More file actions
35 lines (28 loc) · 914 Bytes
/
Interpreter.cpp
File metadata and controls
35 lines (28 loc) · 914 Bytes
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
#include "Interpreter.h"
#include <boost/log/core.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
namespace logging = boost::log;
namespace expr = boost::log::expressions;
Interpreter::Interpreter(LockMgr* lockMgr, ThreadMgr* threadMgr, const char* logFile)
: lockMgr_(lockMgr), threadMgr_(threadMgr), logFile_(logFile) {
initLogger();
}
void Interpreter::initLogger() {
logging::add_file_log(
logging::keywords::file_name = logFile_,
logging::keywords::format = (
expr::stream
<< expr::attr< unsigned int >("LineID")
<< ": <" << logging::trivial::severity
<< "> " << expr::smessage
)
);
logging::core::get()->set_filter
(
logging::trivial::severity >= logging::trivial::trace
);
logging::add_common_attributes();
}