Use the logger everywhere

This commit is contained in:
Florent Le Coz
2013-12-03 19:15:37 +01:00
parent 2662ed89e2
commit a4c845ab6c
10 changed files with 31 additions and 47 deletions
-2
View File
@@ -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)
+5 -5
View File
@@ -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();
}