diff options
author | Mauro Sardara <msardara@cisco.com> | 2022-09-21 10:20:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2022-09-21 10:20:54 +0000 |
commit | 6233c9ce9808a82894d85a9774d71ee6dfc53921 (patch) | |
tree | 1514f89ae05997b251ced6667f84d03aba480b45 /apps/hiperf/src/common.h | |
parent | 08022dfd8da78446b7ec4381965cbf3626c09533 (diff) | |
parent | 582e9a1b4275d89b02d020e1155ee8a0aff65d3b (diff) |
Merge "refactor(logs): use glog instead of prints"
Diffstat (limited to 'apps/hiperf/src/common.h')
-rw-r--r-- | apps/hiperf/src/common.h | 14 |
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; } |