summaryrefslogtreecommitdiffstats
path: root/apps/hiperf/src/common.h
diff options
context:
space:
mode:
authorEnrico Loparco (eloparco) <eloparco@cisco.com>2022-09-19 08:37:30 +0000
committerEnrico Loparco <eloparco@cisco.com>2022-09-21 08:11:14 +0000
commit582e9a1b4275d89b02d020e1155ee8a0aff65d3b (patch)
tree78c3a86e4359f888ffa1450ffd753815fc5e9d20 /apps/hiperf/src/common.h
parent10e0758a2124e8d9d6253a9160e593303b38f71e (diff)
refactor(logs): use glog instead of prints
Ref: HICN-788 Signed-off-by: Enrico Loparco (eloparco) <eloparco@cisco.com> Change-Id: Iedf75e1658a335985cc2dfd7b82ae61124f2371e
Diffstat (limited to 'apps/hiperf/src/common.h')
-rw-r--r--apps/hiperf/src/common.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/hiperf/src/common.h b/apps/hiperf/src/common.h
index 29cc05c71..3a17e0c40 100644
--- a/apps/hiperf/src/common.h
+++ b/apps/hiperf/src/common.h
@@ -30,6 +30,8 @@
#include <hicn/transport/utils/daemonizator.h>
#endif
+#include <hicn/apps/utils/logger.h>
+
#include <asio.hpp>
#include <cmath>
#include <fstream>
@@ -57,8 +59,6 @@ namespace hiperf {
/**
* Logger
*/
-static std::ostream &Logger() { return std::cout; }
-
template <typename D, typename ConfType, typename ParentType>
class Base : protected std::stringbuf, protected std::ostream {
protected:
@@ -103,7 +103,7 @@ class Base : protected std::stringbuf, protected std::ostream {
int sync() override {
auto string = str();
asio::post(io_service_,
- [this, string]() { Logger() << begin_ << string << end_; });
+ [this, string]() { LoggerInfo() << begin_ << string << end_; });
str("");
return 0;
@@ -140,7 +140,7 @@ static inline int ensureFlows(const Prefix &prefix, std::size_t flows) {
} else if (prefix.getAddressFamily() == AF_INET6) {
max_ip_addr_len_bits = IPV6_ADDR_LEN_BITS;
} else {
- Logger() << "Error: unknown address family." << std::endl;
+ LoggerErr() << "Error: unknown address family.";
ret = ERROR_SETUP;
goto end;
}
@@ -149,9 +149,9 @@ static inline int ensureFlows(const Prefix &prefix, std::size_t flows) {
max_n_flow = log2_n_flow < 64 ? (1 << log2_n_flow) : ~0ULL;
if (flows > max_n_flow) {
- Logger() << "Error: the provided prefix length does not allow to "
- "accomodate the provided number of flows ("
- << flows << " > " << max_n_flow << ")." << std::endl;
+ LoggerErr() << "Error: the provided prefix length does not allow to "
+ "accomodate the provided number of flows ("
+ << flows << " > " << max_n_flow << ").";
ret = ERROR_SETUP;
}