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/FileAllocationCommand.cc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/FileAllocationCommand.cc') diff --git a/src/FileAllocationCommand.cc b/src/FileAllocationCommand.cc index a0b9a296..3373d784 100644 --- a/src/FileAllocationCommand.cc +++ b/src/FileAllocationCommand.cc @@ -38,6 +38,7 @@ #include "DownloadEngine.h" #include "RequestGroup.h" #include "Logger.h" +#include "LogFactory.h" #include "message.h" #include "prefs.h" #include "util.h" @@ -47,6 +48,7 @@ #include "RecoverableException.h" #include "wallclock.h" #include "RequestGroupMan.h" +#include "fmt.h" namespace aria2 { @@ -66,12 +68,10 @@ bool FileAllocationCommand::executeInternal() } fileAllocationEntry_->allocateChunk(); if(fileAllocationEntry_->finished()) { - if(getLogger()->debug()) { - getLogger()->debug - (MSG_ALLOCATION_COMPLETED, - static_cast(timer_.difference(global::wallclock)), - util::itos(getRequestGroup()->getTotalLength(), true).c_str()); - } + A2_LOG_DEBUG + (fmt(MSG_ALLOCATION_COMPLETED, + static_cast(timer_.difference(global::wallclock)), + util::itos(getRequestGroup()->getTotalLength(), true).c_str())); getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); std::vector* commands = new std::vector(); @@ -90,11 +90,13 @@ bool FileAllocationCommand::executeInternal() bool FileAllocationCommand::handleException(Exception& e) { getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); - getLogger()->error - (MSG_FILE_ALLOCATION_FAILURE, e, util::itos(getCuid()).c_str()); - getLogger()->error - (MSG_DOWNLOAD_NOT_COMPLETE, util::itos(getCuid()).c_str(), - getRequestGroup()->getDownloadContext()->getBasePath().c_str()); + A2_LOG_ERROR_EX(fmt(MSG_FILE_ALLOCATION_FAILURE, + util::itos(getCuid()).c_str()), + e); + A2_LOG_ERROR + (fmt(MSG_DOWNLOAD_NOT_COMPLETE, + util::itos(getCuid()).c_str(), + getRequestGroup()->getDownloadContext()->getBasePath().c_str())); return true; } -- cgit