From f73f5e279861e92e3f4cfa9b669f9047a2fcd837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Tue, 29 Nov 2016 01:27:42 -0500 Subject: [PATCH] log: cosmetics --- include/opendht/log.h | 3 --- src/log.cpp | 30 +++++++++++++++--------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/include/opendht/log.h b/include/opendht/log.h index 442b28ee..92e11c63 100644 --- a/include/opendht/log.h +++ b/include/opendht/log.h @@ -74,8 +74,5 @@ enableFileLogging(dht::DhtRunner &dht, const std::string &path); OPENDHT_PUBLIC void disableLogging(dht::DhtRunner &dht); - - } /* log */ } /* dht */ - diff --git a/src/log.cpp b/src/log.cpp index e9b70a7a..b689e9fa 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -27,7 +27,7 @@ namespace log { * Print va_list to std::ostream (used for logging). */ void -printLog(std::ostream &s, char const *m, va_list args) { +printLog(std::ostream& s, char const *m, va_list args) { // print log to buffer std::array<char, 8192> buffer; int ret = vsnprintf(buffer.data(), buffer.size(), m, args); @@ -52,17 +52,17 @@ printLog(std::ostream &s, char const *m, va_list args) { 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); } + [](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); } ); } @@ -72,9 +72,9 @@ enableFileLogging(dht::DhtRunner &dht, const std::string &path) { 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); } + [=](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); } ); } -- GitLab