Show off, with some variadic templates, for the logger module

This commit is contained in:
louiz’
2016-06-13 20:46:30 +02:00
parent ad4ccdbbea
commit 5a2e611617
9 changed files with 115 additions and 71 deletions
+7 -7
View File
@@ -20,7 +20,7 @@ Poller::Poller()
this->epfd = ::epoll_create1(0);
if (this->epfd == -1)
{
log_error("epoll failed: " << strerror(errno));
log_error("epoll failed: ", strerror(errno));
throw std::runtime_error("Could not create epoll instance");
}
#endif
@@ -54,7 +54,7 @@ void Poller::add_socket_handler(SocketHandler* socket_handler)
const int res = ::epoll_ctl(this->epfd, EPOLL_CTL_ADD, socket_handler->get_socket(), &event);
if (res == -1)
{
log_error("epoll_ctl failed: " << strerror(errno));
log_error("epoll_ctl failed: ", strerror(errno));
throw std::runtime_error("Could not add socket to epoll");
}
#endif
@@ -86,7 +86,7 @@ void Poller::remove_socket_handler(const socket_t socket)
const int res = ::epoll_ctl(this->epfd, EPOLL_CTL_DEL, socket, nullptr);
if (res == -1)
{
log_error("epoll_ctl failed: " << strerror(errno));
log_error("epoll_ctl failed: ", strerror(errno));
throw std::runtime_error("Could not remove socket from epoll");
}
#endif
@@ -109,7 +109,7 @@ void Poller::watch_send_events(SocketHandler* socket_handler)
const int res = ::epoll_ctl(this->epfd, EPOLL_CTL_MOD, socket_handler->get_socket(), &event);
if (res == -1)
{
log_error("epoll_ctl failed: " << strerror(errno));
log_error("epoll_ctl failed: ", strerror(errno));
throw std::runtime_error("Could not modify socket flags in epoll");
}
#endif
@@ -132,7 +132,7 @@ void Poller::stop_watching_send_events(SocketHandler* socket_handler)
const int res = ::epoll_ctl(this->epfd, EPOLL_CTL_MOD, socket_handler->get_socket(), &event);
if (res == -1)
{
log_error("epoll_ctl failed: " << strerror(errno));
log_error("epoll_ctl failed: ", strerror(errno));
throw std::runtime_error("Could not modify socket flags in epoll");
}
#endif
@@ -165,7 +165,7 @@ int Poller::poll(const std::chrono::milliseconds& timeout)
{
if (errno == EINTR)
return true;
log_error("poll failed: " << strerror(errno));
log_error("poll failed: ", strerror(errno));
throw std::runtime_error("Poll failed");
}
// We cannot possibly have more ready events than the number of fds we are
@@ -205,7 +205,7 @@ int Poller::poll(const std::chrono::milliseconds& timeout)
{
if (errno == EINTR)
return 0;
log_error("epoll wait: " << strerror(errno));
log_error("epoll wait: ", strerror(errno));
throw std::runtime_error("Epoll_wait failed");
}
for (int i = 0; i < nb_events; ++i)