Skip to content
Snippets Groups Projects
Commit 63d50805 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

node: allow to print log

parent 6e12193f
No related branches found
No related tags found
No related merge requests found
...@@ -157,6 +157,7 @@ main(int argc, char **argv) ...@@ -157,6 +157,7 @@ main(int argc, char **argv)
std::cout << "Possible commands:" << std::endl; std::cout << "Possible commands:" << std::endl;
std::cout << " h, help Print this help message." << std::endl; std::cout << " h, help Print this help message." << std::endl;
std::cout << " q, quit Quit the program." << std::endl; std::cout << " q, quit Quit the program." << std::endl;
std::cout << " log Print the full DHT log." << std::endl;
std::cout << std::endl << "Node information:" << std::endl; std::cout << std::endl << "Node information:" << std::endl;
std::cout << " ll Print basic information and stats about the current node." << std::endl; std::cout << " ll Print basic information and stats about the current node." << std::endl;
...@@ -195,6 +196,13 @@ main(int argc, char **argv) ...@@ -195,6 +196,13 @@ main(int argc, char **argv)
std::cout << "Searches:" << std::endl; std::cout << "Searches:" << std::endl;
std::cout << dht.getSearchesLog(AF_INET) << std::endl; std::cout << dht.getSearchesLog(AF_INET) << std::endl;
continue; continue;
} else if (op == "log") {
dht.setLoggers(
[](char const* m, va_list args){ std::cerr << red; printLog(std::cerr, m, args); std::cerr << def; },
[](char const* m, va_list args){ std::cout << yellow; printLog(std::cout, m, args); std::cout << def; },
[](char const* m, va_list args){ printLog(std::cout, m, args); }
);
continue;
} }
if (op.empty()) if (op.empty())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment