-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.cpp
43 lines (36 loc) · 1.04 KB
/
main.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
#include <client/client.hpp>
#include <stub/stub.hpp>
#include <fc/log/logger_config.hpp>
#include <fstream>
#include <iomanip>
#include <iostream>
bool g_stub_test_enable = false;
void rolloutHandler(const char* filename, std::size_t size) {
static int idx = 0;
std::stringstream stream;
stream << filename << "." << ++idx << ".log";
fc::rename(filename, stream.str().c_str());
}
void log_init() {
}
void log_close() {
}
int main(int argc, char** argv) {
if (g_stub_test_enable) {
StubPtr stub = std::make_shared<Stub>();
stub->start();
return 0;
}
log_close();
try {
ClientPtr client = std::make_shared<Client>();
client->configure_from_command_line(argc, argv);
client->start().wait();
} catch (const fc::exception& e) {
std::cerr << "------------ error --------------\n"
<< e.to_detail_string() << "\n";
wlog("${e}", ("e", e.to_detail_string()));
}
fc::configure_logging(fc::logging_config::default_config());
return 0;
}