From 580098eb4929a3bdbf424af18da361259ef2efe5 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 20 Nov 2010 08:21:36 +0000 Subject: 2010-11-20 Tatsuhiro Tsujikawa Rewritten Logger interface. Logger now writes source file name and line number in log file. --- src/PollEventPoll.cc | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/PollEventPoll.cc') diff --git a/src/PollEventPoll.cc b/src/PollEventPoll.cc index 1af0771d..e5933e24 100644 --- a/src/PollEventPoll.cc +++ b/src/PollEventPoll.cc @@ -42,11 +42,13 @@ #include "LogFactory.h" #include "Logger.h" #include "a2functional.h" +#include "fmt.h" namespace aria2 { -PollEventPoll::KSocketEntry::KSocketEntry(sock_t s): - SocketEntry(s) {} +PollEventPoll::KSocketEntry::KSocketEntry(sock_t s) + : SocketEntry(s) +{} int accumulateEvent(int events, const PollEventPoll::KEvent& event) { @@ -73,8 +75,9 @@ struct pollfd PollEventPoll::KSocketEntry::getEvents() return pollEvent; } -PollEventPoll::PollEventPoll(): - pollfdCapacity_(1024), pollfdNum_(0), logger_(LogFactory::getInstance()) +PollEventPoll::PollEventPoll() + : pollfdCapacity_(1024), + pollfdNum_(0) { pollfds_ = new struct pollfd[pollfdCapacity_]; } @@ -103,10 +106,8 @@ void PollEventPoll::poll(const struct timeval& tv) if(itr != socketEntries_.end() && *(*itr) == *se) { (*itr)->processEvents(first->revents); } else { - if(logger_->debug()) { - logger_->debug("Socket %d is not found in SocketEntries.", - first->fd); - } + A2_LOG_DEBUG(fmt("Socket %d is not found in SocketEntries.", + first->fd)); } } } @@ -221,9 +222,7 @@ bool PollEventPoll::deleteEvents } return true; } else { - if(logger_->debug()) { - logger_->debug("Socket %d is not found in SocketEntries.", socket); - } + A2_LOG_DEBUG(fmt("Socket %d is not found in SocketEntries.", socket)); return false; } } -- cgit