-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.cc
49 lines (41 loc) · 1.51 KB
/
main.cc
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
49
#include <residue/residue.h>
int main(int argc, char** argv) {
// Residue::setInternalLoggingLevel(Residue::InternalLoggingLevel::crazy);
Residue::setApplicationArgs(argc, argv);
if (el::Helpers::commandLineArgs()->hasParamWithValue("--conf")) {
try {
Residue::loadConfiguration(el::Helpers::commandLineArgs()->getParamValue("--conf"));
} catch (ResidueException& e) {
std::cout << "Exception (config): " << e.what() << std::endl;
return 1;
}
}
if (el::Helpers::commandLineArgs()->hasParamWithValue("--conn")) {
try {
Residue::loadConnection(el::Helpers::commandLineArgs()->getParamValue("--conn"));
} catch (ResidueException& e) {
std::cout << "Exception (connection): " << e.what() << std::endl;
return 1;
}
} else {
try {
Residue::reconnect();
} catch (ResidueException& e) {
std::cout << "Exception: " << e.what() << std::endl;
return 1;
}
}
std::cout << "Connected to client: " << Residue::instance().clientId() << std::endl;
std::cout << "Server version: " << Residue::instance().serverVersion() << std::endl;
Residue::saveConnection("connection.json");
while (true) {
std::wstring input;
std::cout << "Logger > ";
std::getline(std::wcin, input);
if (!input.empty()) {
CLOG(INFO, "sample-app") << input;
}
}
Residue::disconnect();
return 0;
}