aboutsummaryrefslogtreecommitdiffstats
path: root/apps/http-proxy/includes
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/http-proxy/includes
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/http-proxy/includes')
-rw-r--r--apps/http-proxy/includes/hicn/http-proxy/forwarder_config.h15
-rw-r--r--apps/http-proxy/includes/hicn/http-proxy/http_proxy.h51
2 files changed, 30 insertions, 36 deletions
diff --git a/apps/http-proxy/includes/hicn/http-proxy/forwarder_config.h b/apps/http-proxy/includes/hicn/http-proxy/forwarder_config.h
index 935b85e78..14e0068ed 100644
--- a/apps/http-proxy/includes/hicn/http-proxy/forwarder_config.h
+++ b/apps/http-proxy/includes/hicn/http-proxy/forwarder_config.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Cisco and/or its affiliates.
+ * Copyright (c) 2021-2022 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -15,9 +15,9 @@
#pragma once
+#include <hicn/apps/utils/logger.h>
#include <hicn/transport/portability/c_portability.h>
#include <hicn/transport/utils/branch_prediction.h>
-#include <hicn/transport/utils/log.h>
#include <hicn/transport/utils/string_utils.h>
#include <asio.hpp>
@@ -67,8 +67,7 @@ class ForwarderConfig {
if (ret < 0) {
// We were not able to connect to the local forwarder. Do not give up
// and retry.
- TRANSPORT_LOG_ERROR
- << "Could not connect to local forwarder. Retrying.";
+ LoggerErr() << "Could not connect to local forwarder. Retrying.";
timer_.expires_from_now(std::chrono::milliseconds(RETRY_INTERVAL));
timer_.async_wait(std::bind(&ForwarderConfig::doTryToConnectToForwarder,
@@ -79,8 +78,7 @@ class ForwarderConfig {
doGetMainListener(std::make_error_code(std::errc(0)));
}
} else {
- TRANSPORT_LOG_ERROR
- << "Timer for re-trying forwarder connection canceled.";
+ LoggerErr() << "Timer for re-trying forwarder connection canceled.";
}
}
@@ -91,7 +89,7 @@ class ForwarderConfig {
if (ret <= 0) {
// Since without the main listener of the forwarder the proxy cannot
// work, we can stop the program here until we get the listener port.
- TRANSPORT_LOG_ERROR
+ LoggerErr()
<< "Could not retrieve main listener port from the forwarder. "
"Retrying.";
@@ -105,8 +103,7 @@ class ForwarderConfig {
listener_retrieved_callback_(std::make_error_code(std::errc(0)));
}
} else {
- TRANSPORT_LOG_ERROR
- << "Timer for retrieving main hicn listener canceled.";
+ LoggerErr() << "Timer for retrieving main hicn listener canceled.";
}
}
diff --git a/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h b/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h
index efb9f850e..1fa96956a 100644
--- a/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h
+++ b/apps/http-proxy/includes/hicn/http-proxy/http_proxy.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Cisco and/or its affiliates.
+ * Copyright (c) 2021-2022 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -15,6 +15,7 @@
#pragma once
+#include <hicn/apps/utils/logger.h>
#include <hicn/transport/interfaces/socket_consumer.h>
#include <hicn/transport/utils/event_thread.h>
@@ -147,20 +148,17 @@ class HTTPProxy {
std::string prefix;
std::string first_ipv6_word;
- virtual void printParams() { std::cout << "Parameters: " << std::endl; };
+ virtual void printParams() { LoggerInfo() << "Parameters: "; };
};
struct ClientParams : virtual CommonParams {
short tcp_listen_port;
void printParams() override {
- std::cout << "Running HTTP/TCP -> HTTP/hICN proxy." << std::endl;
+ LoggerInfo() << "Running HTTP/TCP -> HTTP/hICN proxy.";
CommonParams::printParams();
- std::cout << "\t"
- << "HTTP listen port: " << tcp_listen_port << std::endl;
- std::cout << "\t"
- << "Consumer Prefix: " << prefix << std::endl;
- std::cout << "\t"
- << "Prefix first word: " << first_ipv6_word << std::endl;
+ LoggerInfo() << "\tHTTP listen port: " << tcp_listen_port;
+ LoggerInfo() << "\tConsumer Prefix: " << prefix;
+ LoggerInfo() << "\tPrefix first word: " << first_ipv6_word;
}
};
@@ -173,25 +171,24 @@ class HTTPProxy {
bool manifest;
void printParams() override {
- std::cout << "Running HTTP/hICN -> HTTP/TCP proxy." << std::endl;
+ LoggerInfo() << "Running HTTP/hICN -> HTTP/TCP proxy.";
CommonParams::printParams();
- std::cout << "\t"
- << "Origin address: " << origin_address << std::endl;
- std::cout << "\t"
- << "Origin port: " << origin_port << std::endl;
- std::cout << "\t"
- << "Producer cache size: " << cache_size << std::endl;
- std::cout << "\t"
- << "hICN MTU: " << mtu << std::endl;
- std::cout << "\t"
- << "Default content lifetime: " << content_lifetime
- << std::endl;
- std::cout << "\t"
- << "Producer Prefix: " << prefix << std::endl;
- std::cout << "\t"
- << "Prefix first word: " << first_ipv6_word << std::endl;
- std::cout << "\t"
- << "Use manifest: " << manifest << std::endl;
+ LoggerInfo() << "\t"
+ << "Origin address: " << origin_address;
+ LoggerInfo() << "\t"
+ << "Origin port: " << origin_port;
+ LoggerInfo() << "\t"
+ << "Producer cache size: " << cache_size;
+ LoggerInfo() << "\t"
+ << "hICN MTU: " << mtu;
+ LoggerInfo() << "\t"
+ << "Default content lifetime: " << content_lifetime;
+ LoggerInfo() << "\t"
+ << "Producer Prefix: " << prefix;
+ LoggerInfo() << "\t"
+ << "Prefix first word: " << first_ipv6_word;
+ LoggerInfo() << "\t"
+ << "Use manifest: " << manifest;
}
};