From 63d50805ed1bbfd0b00302160c3fc7e3e481f756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Tue, 9 Dec 2014 19:01:54 -0500 Subject: [PATCH] node: allow to print log --- tools/dhtnode.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/dhtnode.cpp b/tools/dhtnode.cpp index 0610c52d..7dd41ab8 100644 --- a/tools/dhtnode.cpp +++ b/tools/dhtnode.cpp @@ -157,6 +157,7 @@ main(int argc, char **argv) std::cout << "Possible commands:" << std::endl; std::cout << " h, help Print this help message." << 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 << " ll Print basic information and stats about the current node." << std::endl; @@ -195,6 +196,13 @@ main(int argc, char **argv) std::cout << "Searches:" << std::endl; std::cout << dht.getSearchesLog(AF_INET) << std::endl; 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()) -- GitLab