summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-12-03 19:10:44 +0100
committerFlorent Le Coz <louiz@louiz.org>2013-12-03 19:15:37 +0100
commita4c845ab6c54172ea305f33734c83238c75d421a (patch)
tree3ed5393e993f0e9b72fabd9413453fadbfe9a9a9 /src/network
parent2662ed89e2cd41477582140e482f1ddbbfdb235e (diff)
downloadbiboumi-a4c845ab6c54172ea305f33734c83238c75d421a.tar.gz
biboumi-a4c845ab6c54172ea305f33734c83238c75d421a.tar.bz2
biboumi-a4c845ab6c54172ea305f33734c83238c75d421a.tar.xz
biboumi-a4c845ab6c54172ea305f33734c83238c75d421a.zip
Use the logger everywhere
Diffstat (limited to 'src/network')
-rw-r--r--src/network/poller.cpp2
-rw-r--r--src/network/socket_handler.cpp10
2 files changed, 5 insertions, 7 deletions
diff --git a/src/network/poller.cpp b/src/network/poller.cpp
index 023fb12..71c7172 100644
--- a/src/network/poller.cpp
+++ b/src/network/poller.cpp
@@ -8,7 +8,6 @@
Poller::Poller()
{
- std::cout << "Poller()" << std::endl;
#if POLLER == POLL
memset(this->fds, 0, sizeof(this->fds));
this->nfds = 0;
@@ -24,7 +23,6 @@ Poller::Poller()
Poller::~Poller()
{
- std::cout << "~Poller()" << std::endl;
}
void Poller::add_socket_handler(std::shared_ptr<SocketHandler> socket_handler)
diff --git a/src/network/socket_handler.cpp b/src/network/socket_handler.cpp
index d75b505..246d8d3 100644
--- a/src/network/socket_handler.cpp
+++ b/src/network/socket_handler.cpp
@@ -3,6 +3,7 @@
#include <utils/scopeguard.hpp>
#include <network/poller.hpp>
+#include <logger/logger.hpp>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
@@ -21,7 +22,7 @@ SocketHandler::SocketHandler():
void SocketHandler::connect(const std::string& address, const std::string& port)
{
- std::cout << "Trying to connect to " << address << ":" << port << std::endl;
+ log_info("Trying to connect to " << address << ":" << port);
struct addrinfo hints;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_flags = 0;
@@ -42,17 +43,16 @@ void SocketHandler::connect(const std::string& address, const std::string& port)
}
for (struct addrinfo* rp = addr_res; rp; rp = rp->ai_next)
{
- std::cout << "One result" << std::endl;
if (::connect(this->socket, rp->ai_addr, rp->ai_addrlen) == 0)
{
- std::cout << "Connection success." << std::endl;
+ log_info("Connection success.");
this->on_connected();
return ;
}
- std::cout << "Connection failed:" << std::endl;
+ log_info("Connection failed:");
perror("connect");
}
- std::cout << "All connection attempts failed." << std::endl;
+ log_error("All connection attempts failed.");
this->close();
}