summaryrefslogtreecommitdiff
path: root/src/DHTAutoSaveCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-20 08:21:36 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-20 08:21:36 +0000
commit580098eb4929a3bdbf424af18da361259ef2efe5 (patch)
treec6ff77fa55fcbdcdd0ca21ec2105db14a8c050d3 /src/DHTAutoSaveCommand.cc
parent3940da75624b194cdd5036f9fe330fcecc725964 (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/DHTAutoSaveCommand.cc')
-rw-r--r--src/DHTAutoSaveCommand.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/DHTAutoSaveCommand.cc b/src/DHTAutoSaveCommand.cc
index f9b06118..308e72e2 100644
--- a/src/DHTAutoSaveCommand.cc
+++ b/src/DHTAutoSaveCommand.cc
@@ -49,17 +49,20 @@
#include "Option.h"
#include "message.h"
#include "Logger.h"
+#include "LogFactory.h"
#include "a2functional.h"
#include "FileEntry.h"
#include "DlAbortEx.h"
#include "StringFormat.h"
+#include "fmt.h"
namespace aria2 {
DHTAutoSaveCommand::DHTAutoSaveCommand
-(cuid_t cuid, DownloadEngine* e, int family, time_t interval):
- TimeBasedCommand(cuid, e, interval),
- family_(family) {}
+(cuid_t cuid, DownloadEngine* e, int family, time_t interval)
+ : TimeBasedCommand(cuid, e, interval),
+ family_(family)
+{}
DHTAutoSaveCommand::~DHTAutoSaveCommand() {}
@@ -82,7 +85,7 @@ void DHTAutoSaveCommand::save()
std::string dhtFile =
getDownloadEngine()->getOption()->
get(family_ == AF_INET? PREF_DHT_FILE_PATH : PREF_DHT_FILE_PATH6);
- getLogger()->info("Saving DHT routing table to %s.", dhtFile.c_str());
+ A2_LOG_INFO(fmt("Saving DHT routing table to %s.", dhtFile.c_str()));
File tempFile(dhtFile+"__temp");
// Removing tempFile is unnecessary because the file is truncated on
@@ -118,12 +121,13 @@ void DHTAutoSaveCommand::save()
serializer.serialize(o);
}
if(!tempFile.renameTo(dhtFile)) {
- getLogger()->error("Cannot move file from %s to %s.",
- tempFile.getPath().c_str(), dhtFile.c_str());
+ A2_LOG_ERROR(fmt("Cannot move file from %s to %s.",
+ tempFile.getPath().c_str(), dhtFile.c_str()));
}
} catch(RecoverableException& e) {
- getLogger()->error("Exception caught while saving DHT routing table to %s",
- e, dhtFile.c_str());
+ A2_LOG_ERROR_EX(fmt("Exception caught while saving DHT routing table to %s",
+ dhtFile.c_str()),
+ e);
}
}