Example #1
0
void
enableDhtLogging(dht::DhtRunner& dht)
{
    dht.setLoggers(
        [](char const* m, va_list args){ dout << "ERR"; printDhtLog(dout, m, args);  },
        [](char const* m, va_list args){ dout << "WARN"; printDhtLog(dout, m, args); },
        [](char const* m, va_list args){ printDhtLog(dout, m, args); }
    );
}
Example #2
0
void
enableFileLogging(dht::DhtRunner &dht, const std::string &path) {
    auto logfile = std::make_shared<std::fstream>();
    logfile->open(path, std::ios::out);

    dht.setLoggers(
        [=](char const *m, va_list args) { printLog(*logfile, m, args); },
        [=](char const *m, va_list args) { printLog(*logfile, m, args); },
        [=](char const *m, va_list args) { printLog(*logfile, m, args); }
    );
}
Example #3
0
void
enableLogging(dht::DhtRunner &dht) {
    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); }
    );
}
Example #4
0
void
disableLogging(dht::DhtRunner &dht) {
    dht.setLoggers(dht::NOLOG, dht::NOLOG, dht::NOLOG);
}