diff options
author | Chris Wilson <chris+github@qwirx.com> | 2008-03-29 01:56:39 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2008-03-29 01:56:39 +0000 |
commit | 2e761f8a7744f18059e2048f319f4cac8e32d765 (patch) | |
tree | add4cfdd6c6e71f3101de346e38f57a803a70aad /lib | |
parent | c414132f88a8a687d50b602cd00087df58fac587 (diff) |
Replace all remaining use of TRACEx() macros with logging framework.
Remove the old TRACEx macros to catch any remaining uses.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/backupclient/BackupStoreFileDiff.cpp | 36 | ||||
-rw-r--r-- | lib/backupclient/BackupStoreFilenameClear.cpp | 6 | ||||
-rw-r--r-- | lib/backupclient/BackupStoreObjectDump.cpp | 10 | ||||
-rw-r--r-- | lib/backupstore/BackupStoreCheck.cpp | 3 | ||||
-rw-r--r-- | lib/backupstore/BackupStoreCheck2.cpp | 35 | ||||
-rw-r--r-- | lib/backupstore/BackupStoreCheckData.cpp | 13 | ||||
-rw-r--r-- | lib/common/Box.h | 19 | ||||
-rw-r--r-- | lib/common/Configuration.cpp | 4 | ||||
-rw-r--r-- | lib/common/DebugMemLeakFinder.cpp | 19 | ||||
-rw-r--r-- | lib/common/Logging.h | 7 | ||||
-rw-r--r-- | lib/common/PartialReadStream.cpp | 3 | ||||
-rw-r--r-- | lib/common/Utils.cpp | 4 | ||||
-rw-r--r-- | lib/compress/Compress.h | 8 | ||||
-rw-r--r-- | lib/compress/CompressStream.cpp | 2 | ||||
-rw-r--r-- | lib/crypto/CipherContext.cpp | 12 | ||||
-rw-r--r-- | lib/intercept/intercept.cpp | 10 | ||||
-rw-r--r-- | lib/raidfile/RaidFileWrite.cpp | 8 | ||||
-rw-r--r-- | lib/server/ProtocolUncertainStream.cpp | 3 |
18 files changed, 123 insertions, 79 deletions
diff --git a/lib/backupclient/BackupStoreFileDiff.cpp b/lib/backupclient/BackupStoreFileDiff.cpp index f7842a0b..d550e2ba 100644 --- a/lib/backupclient/BackupStoreFileDiff.cpp +++ b/lib/backupclient/BackupStoreFileDiff.cpp @@ -149,7 +149,7 @@ std::auto_ptr<IOStream> BackupStoreFile::EncodeFileDiff int64_t blocksInIndex = 0; bool canDiffFromThis = false; LoadIndex(rDiffFromBlockIndex, DiffFromObjectID, &pindex, blocksInIndex, Timeout, canDiffFromThis); - //TRACE1("Diff: Blocks in index: %lld\n", blocksInIndex); + // BOX_TRACE("Diff: Blocks in index: " << blocksInIndex); if(!canDiffFromThis) { @@ -439,7 +439,9 @@ static void FindMostUsedSizes(BlocksAvailableEntry *pIndex, int64_t NumBlocks, i { for(int t = 0; t < BACKUP_FILE_DIFF_MAX_BLOCK_SIZES; ++t) { - TRACE3("Diff block size %d: %d (count = %lld)\n", t, Sizes[t], sizeCounts[t]); + BOX_TRACE("Diff block size " << t << ": " << + Sizes[t] << " (count = " << + sizeCounts[t] << ")"); } } #endif @@ -774,7 +776,7 @@ static void SetupHashTable(BlocksAvailableEntry *pIndex, int64_t NumBlocks, int3 // Already present in table? if(pHashTable[hash] != 0) { - //TRACE1("Another hash entry for %d found\n", hash); + //BOX_TRACE("Another hash entry for " << hash << " found"); // Yes -- need to set the pointer in this entry to the current entry to build the linked list pIndex[b].mpNextInHashList = pHashTable[hash]; } @@ -840,17 +842,19 @@ static bool SecondStageMatch(BlocksAvailableEntry *pFirstInHashList, RollingChec // Then go through the entries in the hash list, comparing with the strong digest calculated scan = pFirstInHashList; - //TRACE0("second stage match\n"); + //BOX_TRACE("second stage match"); while(scan != 0) { - //TRACE3("scan size %d, block size %d, hash %d\n", scan->mSize, BlockSize, Hash); + //BOX_TRACE("scan size " << scan->mSize << + // ", block size " << BlockSize << + // ", hash " << Hash); ASSERT(scan->mSize == BlockSize); ASSERT(RollingChecksum::ExtractHashingComponent(scan->mWeakChecksum) == DEBUG_Hash); // Compare? if(strong.DigestMatches(scan->mStrongChecksum)) { - //TRACE0("Match!\n"); + //BOX_TRACE("Match!\n"); // Found! Add to list of found blocks... int64_t fileOffset = (FileBlockNumber * BlockSize) + Offset; int64_t blockIndex = (scan - pIndex); // pointer arthmitic is frowned upon. But most efficient way of doing it here -- alternative is to use more memory @@ -912,7 +916,8 @@ static void GenerateRecipe(BackupStoreFileEncodeStream::Recipe &rRecipe, BlocksA #ifndef NDEBUG if(BackupStoreFile::TraceDetailsOfDiffProcess) { - TRACE1("Diff: Default recipe generated, %lld bytes of file\n", SizeOfInputFile); + BOX_TRACE("Diff: Default recipe generated, " << + SizeOfInputFile << " bytes of file"); } #endif @@ -1005,10 +1010,14 @@ static void GenerateRecipe(BackupStoreFileEncodeStream::Recipe &rRecipe, BlocksA // dump out the recipe #ifndef NDEBUG - TRACE2("Diff: %lld new bytes found, %lld old blocks used\n", debug_NewBytesFound, debug_OldBlocksUsed); + BOX_TRACE("Diff: " << + debug_NewBytesFound << " new bytes found, " << + debug_OldBlocksUsed << " old blocks used"); if(BackupStoreFile::TraceDetailsOfDiffProcess) { - TRACE1("Diff: Recipe generated (size %d)\n======== ========= ========\nSpace b4 FirstBlk NumBlks\n", rRecipe.size()); + BOX_TRACE("Diff: Recipe generated (size " << rRecipe.size()); + BOX_TRACE("======== ========= ========"); + BOX_TRACE("Space b4 FirstBlk NumBlks"); { for(unsigned int e = 0; e < rRecipe.size(); ++e) { @@ -1018,10 +1027,15 @@ static void GenerateRecipe(BackupStoreFileEncodeStream::Recipe &rRecipe, BlocksA #else sprintf(b, "%8lld", (int64_t)(rRecipe[e].mpStartBlock - pIndex)); #endif - TRACE3("%8lld %s %8lld\n", rRecipe[e].mSpaceBefore, (rRecipe[e].mpStartBlock == 0)?" -":b, (int64_t)rRecipe[e].mBlocks); + BOX_TRACE(std::setw(8) << + rRecipe[e].mSpaceBefore << + " " << + ((rRecipe[e].mpStartBlock == 0)?" -":b) << + " " << std::setw(8) << + rRecipe[e].mBlocks); } } - TRACE0("======== ========= ========\n"); + BOX_TRACE("======== ========= ========"); } #endif } diff --git a/lib/backupclient/BackupStoreFilenameClear.cpp b/lib/backupclient/BackupStoreFilenameClear.cpp index 9114fdd1..cf168bfc 100644 --- a/lib/backupclient/BackupStoreFilenameClear.cpp +++ b/lib/backupclient/BackupStoreFilenameClear.cpp @@ -167,7 +167,8 @@ void BackupStoreFilenameClear::MakeClearAvailable() const switch(encoding) { case Encoding_Clear: - TRACE0("**** BackupStoreFilename encoded with Clear encoding ****\n"); + BOX_TRACE("**** BackupStoreFilename encoded with " + "Clear encoding ****"); mClearFilename.assign(c_str() + 2, size - 2); break; @@ -193,7 +194,8 @@ static void EnsureEncDecBufferSize(int BufSize) if(spEncDecBuffer == 0) { #ifndef WIN32 - TRACE1("Allocating filename encoding/decoding buffer with size %d\n", BufSize); + BOX_TRACE("Allocating filename encoding/decoding buffer " + "with size " << BufSize); #endif spEncDecBuffer = new MemoryBlockGuard<uint8_t *>(BufSize); MEMLEAKFINDER_NOT_A_LEAK(spEncDecBuffer); diff --git a/lib/backupclient/BackupStoreObjectDump.cpp b/lib/backupclient/BackupStoreObjectDump.cpp index d3d9cc17..0ad044bb 100644 --- a/lib/backupclient/BackupStoreObjectDump.cpp +++ b/lib/backupclient/BackupStoreObjectDump.cpp @@ -47,7 +47,7 @@ static void OutputLine(FILE *file, bool ToTrace, const char *format, ...) } if(ToTrace) { - TRACE1("%s", text); + BOX_TRACE(text); } } @@ -211,14 +211,16 @@ void BackupStoreFile::DumpFile(void *clibFileHandle, bool ToTrace, IOStream &rFi if(s > 0) { nnew++; - TRACE2("%8lld this s=%8lld\n", b, s); + BOX_TRACE(std::setw(8) << b << " this s=" << + std::setw(8) << s); } else { nold++; - TRACE2("%8lld other i=%8lld\n", b, 0 - s); + BOX_TRACE(std::setw(8) << b << " other i=" << + std::setw(8) << 0 - s); } } - TRACE0("======== ===== ==========\n"); + BOX_TRACE("======== ===== =========="); } diff --git a/lib/backupstore/BackupStoreCheck.cpp b/lib/backupstore/BackupStoreCheck.cpp index 176ece8f..7598094e 100644 --- a/lib/backupstore/BackupStoreCheck.cpp +++ b/lib/backupstore/BackupStoreCheck.cpp @@ -268,7 +268,8 @@ void BackupStoreCheck::CheckObjects() } maxDir = CheckObjectsScanDir(0, 1, mStoreRoot); - TRACE1("Max dir starting ID is %llx\n", maxDir); + BOX_TRACE("Max dir starting ID is " << + BOX_FORMAT_OBJECTID(maxDir)); } // Then go through and scan all the objects within those directories diff --git a/lib/backupstore/BackupStoreCheck2.cpp b/lib/backupstore/BackupStoreCheck2.cpp index 9c6f2452..40d34a5b 100644 --- a/lib/backupstore/BackupStoreCheck2.cpp +++ b/lib/backupstore/BackupStoreCheck2.cpp @@ -594,6 +594,8 @@ void BackupStoreCheck::WriteNewStoreInfo() } } +#define FMT_OID(x) BOX_FORMAT_OBJECTID(x) +#define FMT_i BOX_FORMAT_OBJECTID((*i)->GetObjectID()) // -------------------------------------------------------------------------- // @@ -620,7 +622,11 @@ bool BackupStoreDirectory::CheckAndFix() if(newerEn == 0) { // Depends on something, but it isn't there. - TRACE2("Entry id %llx removed because depends on newer version %llx which doesn't exist\n", (*i)->GetObjectID(), dependsNewer); + BOX_TRACE("Entry id " << FMT_i << + " removed because depends " + "on newer version " << + FMT_OID(dependsNewer) << + " which doesn't exist"); // Remove delete *i; @@ -638,7 +644,12 @@ bool BackupStoreDirectory::CheckAndFix() if(newerEn->GetDependsOlder() != (*i)->GetObjectID()) { // Wrong entry - TRACE3("Entry id %llx, correcting DependsOlder to %llx, was %llx\n", dependsNewer, (*i)->GetObjectID(), newerEn->GetDependsOlder()); + BOX_TRACE("Entry id " << + FMT_OID(dependsNewer) << + ", correcting DependsOlder to " << + FMT_i << + ", was " << + FMT_OID(newerEn->GetDependsOlder())); newerEn->SetDependsOlder((*i)->GetObjectID()); // Mark as changed changed = true; @@ -657,7 +668,11 @@ bool BackupStoreDirectory::CheckAndFix() if(dependsOlder != 0 && FindEntryByID(dependsOlder) == 0) { // Has an older version marked, but this doesn't exist. Remove this mark - TRACE2("Entry id %llx was marked that %llx depended on it, which doesn't exist, dependency info cleared\n", (*i)->GetObjectID(), dependsOlder); + BOX_TRACE("Entry id " << FMT_i << + " was marked as depended on by " << + FMT_OID(dependsOlder) << ", " + "which doesn't exist, dependency " + "info cleared"); (*i)->SetDependsOlder(0); @@ -693,7 +708,7 @@ bool BackupStoreDirectory::CheckAndFix() bool removeEntry = false; if((*i) == 0) { - TRACE0("Remove because null pointer found\n"); + BOX_TRACE("Remove because null pointer found"); removeEntry = true; } else @@ -704,7 +719,8 @@ bool BackupStoreDirectory::CheckAndFix() if(isDir && (((*i)->GetFlags() & Entry::Flags_File) == Entry::Flags_File)) { // Bad! Unset the file flag - TRACE1("Entry %llx: File flag set when dir flag set\n", (*i)->GetObjectID()); + BOX_TRACE("Entry " << FMT_i << + ": File flag and dir flag both set"); (*i)->RemoveFlags(Entry::Flags_File); changed = true; } @@ -713,7 +729,8 @@ bool BackupStoreDirectory::CheckAndFix() if(idsEncountered.find((*i)->GetObjectID()) != idsEncountered.end()) { // ID already seen, or type doesn't match - TRACE1("Entry %llx: Remove because ID already seen\n", (*i)->GetObjectID()); + BOX_TRACE("Entry " << FMT_i << + ": Remove because ID already seen"); removeEntry = true; } else @@ -730,7 +747,8 @@ bool BackupStoreDirectory::CheckAndFix() && ((*i)->GetFlags() & Entry::Flags_Deleted) == 0) { // Not set, set it - TRACE1("Entry %llx: Set old flag\n", (*i)->GetObjectID()); + BOX_TRACE("Entry " << FMT_i << + ": Set old flag"); (*i)->AddFlags(Entry::Flags_OldVersion); changed = true; } @@ -741,7 +759,8 @@ bool BackupStoreDirectory::CheckAndFix() if(((*i)->GetFlags() & Entry::Flags_OldVersion) == Entry::Flags_OldVersion) { // Set, unset it - TRACE1("Entry %llx: Old flag unset\n", (*i)->GetObjectID()); + BOX_TRACE("Entry " << FMT_i << + ": Old flag unset"); (*i)->RemoveFlags(Entry::Flags_OldVersion); changed = true; } diff --git a/lib/backupstore/BackupStoreCheckData.cpp b/lib/backupstore/BackupStoreCheckData.cpp index f22c8339..aeb96173 100644 --- a/lib/backupstore/BackupStoreCheckData.cpp +++ b/lib/backupstore/BackupStoreCheckData.cpp @@ -189,15 +189,18 @@ void BackupStoreCheck::DumpObjectInfo() { IDBlock *pblock = i->second; int32_t bentries = (pblock == mpInfoLastBlock)?mInfoLastBlockEntries:BACKUPSTORECHECK_BLOCK_SIZE; - TRACE2("BLOCK @ 0x%08x, %d entries\n", pblock, bentries); + BOX_TRACE("BLOCK @ " << BOX_FORMAT_HEX32(pblock) << + ", " << bentries << " entries"); for(int e = 0; e < bentries; ++e) { uint8_t flags = GetFlags(pblock, e); - TRACE4("id %llx, c %llx, %s, %s\n", - pblock->mID[e], pblock->mContainer[e], - (flags & Flags_IsDir)?"dir":"file", - (flags & Flags_IsContained)?"contained":"unattached"); + BOX_TRACE(std::hex << + "id " << pblock->mID[e] << + ", c " << pblock->mContainer[e] << + ", " << ((flags & Flags_IsDir)?"dir":"file") << + ", " << ((flags & Flags_IsContained) ? + "contained":"unattached")); } } } diff --git a/lib/common/Box.h b/lib/common/Box.h index d0e7ab1e..dd91dfe2 100644 --- a/lib/common/Box.h +++ b/lib/common/Box.h @@ -52,15 +52,6 @@ extern bool BoxDebugTraceOn; int BoxDebug_printf(const char *format, ...); int BoxDebugTrace(const char *format, ...); - #define TRACE0(msg) {BoxDebugTrace("%s", msg);} - #define TRACE1(msg, a0) {BoxDebugTrace(msg, a0);} - #define TRACE2(msg, a0, a1) {BoxDebugTrace(msg, a0, a1);} - #define TRACE3(msg, a0, a1, a2) {BoxDebugTrace(msg, a0, a1, a2);} - #define TRACE4(msg, a0, a1, a2, a3) {BoxDebugTrace(msg, a0, a1, a2, a3);} - #define TRACE5(msg, a0, a1, a2, a3, a4) {BoxDebugTrace(msg, a0, a1, a2, a3, a4);} - #define TRACE6(msg, a0, a1, a2, a3, a4, a5) {BoxDebugTrace(msg, a0, a1, a2, a3, a4, a5);} - #define TRACE7(msg, a0, a1, a2, a3, a4, a5, a6) {BoxDebugTrace(msg, a0, a1, a2, a3, a4, a5, a6);} - #define TRACE8(msg, a0, a1, a2, a3, a4, a5, a6, a7) {BoxDebugTrace(msg, a0, a1, a2, a3, a4, a5, a6, a7);} #ifndef PLATFORM_DISABLE_MEM_LEAK_TESTING #define BOX_MEMORY_LEAK_TESTING @@ -76,16 +67,6 @@ #define TRACE_TO_SYSLOG(x) {} #define TRACE_TO_STDOUT(x) {} - #define TRACE0(msg) - #define TRACE1(msg, a0) - #define TRACE2(msg, a0, a1) - #define TRACE3(msg, a0, a1, a2) - #define TRACE4(msg, a0, a1, a2, a3) - #define TRACE5(msg, a0, a1, a2, a3, a4) - #define TRACE6(msg, a0, a1, a2, a3, a4, a5) - #define TRACE7(msg, a0, a1, a2, a3, a4, a5, a6) - #define TRACE8(msg, a0, a1, a2, a3, a4, a5, a6, a7) - // Box Backup builds release get extra information for exception logging #define EXCEPTION_CODENAMES_EXTENDED #define EXCEPTION_CODENAMES_EXTENDED_WITH_DESCRIPTION diff --git a/lib/common/Configuration.cpp b/lib/common/Configuration.cpp index f797f454..10e06680 100644 --- a/lib/common/Configuration.cpp +++ b/lib/common/Configuration.cpp @@ -208,8 +208,8 @@ std::auto_ptr<Configuration> Configuration::LoadAndVerify( if(!rErrorMsg.empty()) { // An error occured, return now - //TRACE1("Error message from LoadInto: %s", rErrorMsg.c_str()); - TRACE0("Error at Configuration::LoadInfo\n"); + BOX_ERROR("Error in Configuration::LoadInfo: " << + rErrorMsg); delete pconfig; pconfig = 0; return std::auto_ptr<Configuration>(0); diff --git a/lib/common/DebugMemLeakFinder.cpp b/lib/common/DebugMemLeakFinder.cpp index 87cdf00d..094820b3 100644 --- a/lib/common/DebugMemLeakFinder.cpp +++ b/lib/common/DebugMemLeakFinder.cpp @@ -146,7 +146,9 @@ void *memleakfinder_realloc(void *ptr, size_t size) std::map<void *, MallocBlockInfo>::iterator i(sMallocBlocks.find(ptr)); if(ptr && i == sMallocBlocks.end()) { - TRACE1("Block %x realloc(), but not in list. Error? Or allocated in startup static objects?\n", ptr); + BOX_WARNING("Block " << ptr << " realloc()ated, but not " + "in list. Error? Or allocated in startup static " + "objects?"); } void *b = ::realloc(ptr, size); @@ -193,7 +195,9 @@ void memleakfinder_free(void *ptr) } else { - TRACE1("Block %p freed, but not known. Error? Or allocated in startup static allocation?\n", ptr); + BOX_WARNING("Block " << ptr << " freed, but not " + "known. Error? Or allocated in startup " + "static allocation?"); } if(sTrackMallocInSection) @@ -293,16 +297,21 @@ void memleakfinder_traceblocksinsection() std::map<void *, MallocBlockInfo>::const_iterator i(sMallocBlocks.find(*s)); if(i == sMallocBlocks.end()) { - TRACE0("Logical error in section block finding\n"); + BOX_WARNING("Logical error in section block finding"); } else { - TRACE4("Block %p size %d allocated at %s:%d\n", i->first, i->second.size, i->second.file, i->second.line); + BOX_TRACE("Block " << i->first << " size " << + i->second.size << " allocated at " << + i->second.file << ":" << i->second.line); } } for(std::map<void *, ObjectInfo>::const_iterator i(sSectionObjectBlocks.begin()); i != sSectionObjectBlocks.end(); ++i) { - TRACE5("Object%s %p size %d allocated at %s:%d\n", i->second.array?" []":"", i->first, i->second.size, i->second.file, i->second.line); + BOX_TRACE("Object" << (i->second.array?" []":"") << " " << + i->first << " size " << i->second.size << + " allocated at " << i->second.file << + ":" << i->second.line); } } diff --git a/lib/common/Logging.h b/lib/common/Logging.h index 2d09b319..dafafbbd 100644 --- a/lib/common/Logging.h +++ b/lib/common/Logging.h @@ -62,15 +62,18 @@ BOX_ERROR(stuff << ": " << GetErrorMessage(number)) #endif -#define BOX_FORMAT_ACCOUNT(accno) \ +#define BOX_FORMAT_HEX32(number) \ std::hex << \ std::showbase << \ std::internal << \ std::setw(10) << \ std::setfill('0') << \ - (accno) << \ + (number) << \ std::dec +#define BOX_FORMAT_ACCOUNT(accno) \ + BOX_FORMAT_HEX32(accno) + #define BOX_FORMAT_OBJECTID(objectid) \ std::hex << \ std::showbase << \ diff --git a/lib/common/PartialReadStream.cpp b/lib/common/PartialReadStream.cpp index 76096738..f2f79715 100644 --- a/lib/common/PartialReadStream.cpp +++ b/lib/common/PartialReadStream.cpp @@ -44,7 +44,8 @@ PartialReadStream::~PartialReadStream() // Warn in debug mode if(mBytesLeft != 0) { - TRACE1("PartialReadStream::~PartialReadStream when mBytesLeft = %d\n", mBytesLeft); + BOX_TRACE("PartialReadStream destroyed with " << mBytesLeft << + " bytes remaining"); } } diff --git a/lib/common/Utils.cpp b/lib/common/Utils.cpp index 83a12ccf..66fab21f 100644 --- a/lib/common/Utils.cpp +++ b/lib/common/Utils.cpp @@ -53,10 +53,10 @@ void SplitString(const std::string &String, char SplitOn, std::vector<std::strin rOutput.push_back(String.substr(b)); } /*#ifndef NDEBUG - TRACE2("Splitting string '%s' on %c\n", String.c_str(), SplitOn); + BOX_TRACE("Splitting string '" << String << " on " << (char)SplitOn); for(unsigned int l = 0; l < rOutput.size(); ++l) { - TRACE2("%d = '%s'\n", l, rOutput[l].c_str()); + BOX_TRACE(l << " = '" << rOutput[l] << "'"); } #endif*/ } diff --git a/lib/compress/Compress.h b/lib/compress/Compress.h index 4a98a59e..de38af2c 100644 --- a/lib/compress/Compress.h +++ b/lib/compress/Compress.h @@ -52,10 +52,12 @@ public: if((r = ((Compressing)?(deflateEnd(&mStream)) :(inflateEnd(&mStream)))) != Z_OK) { - TRACE1("zlib error code = %d\n", r); + BOX_WARNING("zlib error code = " << r); if(r == Z_DATA_ERROR) { - TRACE0("WARNING: End of compress/decompress without all input being consumed -- possible corruption?\n"); + BOX_WARNING("End of compress/decompress " + "without all input being consumed, " + "possible corruption?"); } else { @@ -148,7 +150,7 @@ public: // Check errors if(ret < 0) { - TRACE1("zlib error code = %d\n", ret); + BOX_WARNING("zlib error code = " << ret); THROW_EXCEPTION(CompressException, TransformFailed) } diff --git a/lib/compress/CompressStream.cpp b/lib/compress/CompressStream.cpp index 2839b647..322b203b 100644 --- a/lib/compress/CompressStream.cpp +++ b/lib/compress/CompressStream.cpp @@ -414,7 +414,7 @@ void CompressStream::CheckBuffer() { size *= 2; } - TRACE1("Allocating CompressStream buffer, size %d\n", size); + BOX_TRACE("Allocating CompressStream buffer, size " << size); mpBuffer = ::malloc(size); if(mpBuffer == 0) { diff --git a/lib/crypto/CipherContext.cpp b/lib/crypto/CipherContext.cpp index 8c3b25b2..d68c4b5d 100644 --- a/lib/crypto/CipherContext.cpp +++ b/lib/crypto/CipherContext.cpp @@ -166,7 +166,8 @@ void CipherContext::Begin() // Warn if in a transformation (not an error, because a context might not have been finalised if an exception occured) if(mWithinTransform) { - TRACE0("CipherContext::Begin called when context flagged as within a transform\n"); + BOX_WARNING("CipherContext::Begin called when context " + "flagged as within a transform"); } // Initialise the cipher context again @@ -423,7 +424,8 @@ int CipherContext::TransformBlock(void *pOutBuffer, int OutLength, const void *p // Warn if in a transformation if(mWithinTransform) { - TRACE0("CipherContext::TransformBlock called when context flagged as within a transform\n"); + BOX_WARNING("CipherContext::TransformBlock called when " + "context flagged as within a transform"); } // Check output buffer size @@ -521,7 +523,8 @@ void CipherContext::SetIV(const void *pIV) // Warn if in a transformation if(mWithinTransform) { - TRACE0("CipherContext::SetIV called when context flagged as within a transform\n"); + BOX_WARNING("CipherContext::SetIV called when context " + "flagged as within a transform"); } // Set IV @@ -559,7 +562,8 @@ const void *CipherContext::SetRandomIV(int &rLengthOut) // Warn if in a transformation if(mWithinTransform) { - TRACE0("CipherContext::SetRandomIV called when context flagged as within a transform\n"); + BOX_WARNING("CipherContext::SetRandomIV called when " + "context flagged as within a transform"); } // Get length of IV diff --git a/lib/intercept/intercept.cpp b/lib/intercept/intercept.cpp index 65514ae2..bbcb740e 100644 --- a/lib/intercept/intercept.cpp +++ b/lib/intercept/intercept.cpp @@ -375,12 +375,12 @@ void intercept_setup_readdir_hook(const char *dirname, readdir_t hookfn) if (hookfn != NULL) { - TRACE2("readdir hooked to %p for %s\n", hookfn, dirname); + BOX_TRACE("readdir hooked to " << hookfn << " for " << dirname); } else if (intercept_filename != NULL) { - TRACE2("readdir unhooked from %p for %s\n", readdir_hook, - intercept_filename); + BOX_TRACE("readdir unhooked from " << readdir_hook << + " for " << intercept_filename); } intercept_filename = dirname; @@ -392,11 +392,11 @@ void intercept_setup_lstat_hook(const char *filename, lstat_t hookfn) /* if (hookfn != NULL) { - TRACE2("lstat hooked to %p for %s\n", hookfn, filename); + BOX_TRACE("lstat hooked to " << hookfn << " for " << filename); } else { - TRACE2("lstat unhooked from %p for %s\n", lstat_hook, + BOX_TRACE("lstat unhooked from " << lstat_hook << " for " << lstat_file); } */ diff --git a/lib/raidfile/RaidFileWrite.cpp b/lib/raidfile/RaidFileWrite.cpp index 66ab81c8..c8c39dc4 100644 --- a/lib/raidfile/RaidFileWrite.cpp +++ b/lib/raidfile/RaidFileWrite.cpp @@ -96,7 +96,8 @@ void RaidFileWrite::Open(bool AllowOverwrite) RaidFileUtil::ExistType existance = RaidFileUtil::RaidFileExists(rdiscSet, mFilename); if(existance != RaidFileUtil::NoFile) { - TRACE2("Trying to overwrite raidfile %d %s\n", mSetNumber, mFilename.c_str()); + BOX_ERROR("Attempted to overwrite raidfile " << + mSetNumber << " " << mFilename); THROW_EXCEPTION(RaidFileException, CannotOverwriteExistingFile) } } @@ -178,7 +179,8 @@ void RaidFileWrite::Write(const void *pBuffer, int Length) int written = ::write(mOSFileHandle, pBuffer, Length); if(written != Length) { - TRACE3("RaidFileWrite::Write: Write failure, Length = %d, written = %d, errno = %d\n", Length, written, errno); + BOX_LOG_SYS_ERROR("RaidFileWrite failed, Length = " << + Length << ", written = " << written); THROW_EXCEPTION(RaidFileException, OSError) } } @@ -779,7 +781,7 @@ int RaidFileWrite::Read(void *pBuffer, int NBytes, int Timeout) // -------------------------------------------------------------------------- void RaidFileWrite::Close() { - TRACE0("Warning: RaidFileWrite::Close() called, discarding file\n"); + BOX_WARNING("RaidFileWrite::Close() called, discarding file"); if(mOSFileHandle != -1) { Discard(); diff --git a/lib/server/ProtocolUncertainStream.cpp b/lib/server/ProtocolUncertainStream.cpp index 60c1fa1d..9c15455d 100644 --- a/lib/server/ProtocolUncertainStream.cpp +++ b/lib/server/ProtocolUncertainStream.cpp @@ -41,7 +41,8 @@ ProtocolUncertainStream::~ProtocolUncertainStream() { if(!mFinished) { - TRACE0("ProtocolUncertainStream::~ProtocolUncertainStream() destroyed when stream not complete\n"); + BOX_WARNING("ProtocolUncertainStream destroyed before " + "stream finished"); } } |