diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-11-20 08:21:36 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-11-20 08:21:36 +0000 |
| commit | 580098eb4929a3bdbf424af18da361259ef2efe5 (patch) | |
| tree | c6ff77fa55fcbdcdd0ca21ec2105db14a8c050d3 /src/HttpServerResponseCommand.cc | |
| parent | 3940da75624b194cdd5036f9fe330fcecc725964 (diff) | |
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten Logger interface. Logger now writes source file name and
line number in log file.
Diffstat (limited to 'src/HttpServerResponseCommand.cc')
| -rw-r--r-- | src/HttpServerResponseCommand.cc | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/src/HttpServerResponseCommand.cc b/src/HttpServerResponseCommand.cc index c234c76a..f282cf45 100644 --- a/src/HttpServerResponseCommand.cc +++ b/src/HttpServerResponseCommand.cc @@ -37,11 +37,13 @@ #include "DownloadEngine.h" #include "HttpServer.h" #include "Logger.h" +#include "LogFactory.h" #include "HttpServerCommand.h" #include "RequestGroupMan.h" #include "RecoverableException.h" #include "wallclock.h" #include "util.h" +#include "fmt.h" namespace aria2 { @@ -49,11 +51,11 @@ HttpServerResponseCommand::HttpServerResponseCommand (cuid_t cuid, const SharedHandle<HttpServer>& httpServer, DownloadEngine* e, - const SharedHandle<SocketCore>& socket): - Command(cuid), - e_(e), - socket_(socket), - httpServer_(httpServer) + const SharedHandle<SocketCore>& socket) + : Command(cuid), + e_(e), + socket_(socket), + httpServer_(httpServer) { setStatus(Command::STATUS_ONESHOT_REALTIME); e_->addSocketForWriteCheck(socket_, this); @@ -72,33 +74,27 @@ bool HttpServerResponseCommand::execute() try { httpServer_->sendResponse(); } catch(RecoverableException& e) { - if(getLogger()->info()) { - getLogger()->info - ("CUID#%s - Error occurred while transmitting response body.", - e, util::itos(getCuid()).c_str()); - } + A2_LOG_INFO_EX + (fmt("CUID#%s - Error occurred while transmitting response body.", + util::itos(getCuid()).c_str()), + e); return true; } if(httpServer_->sendBufferIsEmpty()) { - if(getLogger()->info()) { - getLogger()->info("CUID#%s - HttpServer: all response transmitted.", - util::itos(getCuid()).c_str()); - } + A2_LOG_INFO(fmt("CUID#%s - HttpServer: all response transmitted.", + util::itos(getCuid()).c_str())); if(httpServer_->supportsPersistentConnection()) { - if(getLogger()->info()) { - getLogger()->info("CUID#%s - Persist connection.", - util::itos(getCuid()).c_str()); - } + A2_LOG_INFO(fmt("CUID#%s - Persist connection.", + util::itos(getCuid()).c_str())); e_->addCommand (new HttpServerCommand(getCuid(), httpServer_, e_, socket_)); } return true; } else { if(timeoutTimer_.difference(global::wallclock) >= 10) { - if(getLogger()->info()) { - getLogger()->info("CUID#%s - HttpServer: Timeout while trasmitting" - " response.", util::itos(getCuid()).c_str()); - } + A2_LOG_INFO(fmt("CUID#%s - HttpServer: Timeout while trasmitting" + " response.", + util::itos(getCuid()).c_str())); return true; } else { e_->addCommand(this); |
