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/AdaptiveFileAllocationIterator.cc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/AdaptiveFileAllocationIterator.cc') diff --git a/src/AdaptiveFileAllocationIterator.cc b/src/AdaptiveFileAllocationIterator.cc index 347ae0df..8eeb5f99 100644 --- a/src/AdaptiveFileAllocationIterator.cc +++ b/src/AdaptiveFileAllocationIterator.cc @@ -45,9 +45,11 @@ namespace aria2 { AdaptiveFileAllocationIterator::AdaptiveFileAllocationIterator -(BinaryStream* stream, off_t offset, uint64_t totalLength): - stream_(stream), offset_(offset), totalLength_(totalLength), - logger_(LogFactory::getInstance()) {} +(BinaryStream* stream, off_t offset, uint64_t totalLength) + : stream_(stream), + offset_(offset), + totalLength_(totalLength) +{} AdaptiveFileAllocationIterator::~AdaptiveFileAllocationIterator() {} @@ -56,23 +58,17 @@ void AdaptiveFileAllocationIterator::allocateChunk() if(!allocator_) { #ifdef HAVE_FALLOCATE try { - if(logger_->debug()) { - logger_->debug("Testing file system supports fallocate."); - } + A2_LOG_DEBUG("Testing file system supports fallocate."); if(static_cast(offset_) < totalLength_) { off_t len = std::min(totalLength_-offset_, static_cast(4096)); stream_->allocate(offset_, len); offset_ += len; } - if(logger_->debug()) { - logger_->debug("File system supports fallocate."); - } + A2_LOG_DEBUG("File system supports fallocate."); allocator_.reset (new FallocFileAllocationIterator(stream_, offset_, totalLength_)); } catch(RecoverableException& e) { - if(logger_->debug()) { - logger_->debug("File system does not support fallocate."); - } + A2_LOG_DEBUG("File system does not support fallocate."); SharedHandle salloc (new SingleFileAllocationIterator(stream_, offset_, totalLength_)); salloc->init(); -- cgit