[Box Backup-commit] COMMIT r2119 - in box/trunk: bin/bbackupd bin/bbstored lib/backupclient lib/backupstore lib/common lib/compress lib/crypto lib/intercept lib/raidfile lib/server

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sat, 29 Mar 2008 01:56:39 +0000 (UTC)


Author: chris
Date: 2008-03-29 01:56:39 +0000 (Sat, 29 Mar 2008)
New Revision: 2119

Modified:
   box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp
   box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp
   box/trunk/bin/bbstored/BackupContext.cpp
   box/trunk/lib/backupclient/BackupStoreFileDiff.cpp
   box/trunk/lib/backupclient/BackupStoreFilenameClear.cpp
   box/trunk/lib/backupclient/BackupStoreObjectDump.cpp
   box/trunk/lib/backupstore/BackupStoreCheck.cpp
   box/trunk/lib/backupstore/BackupStoreCheck2.cpp
   box/trunk/lib/backupstore/BackupStoreCheckData.cpp
   box/trunk/lib/common/Box.h
   box/trunk/lib/common/Configuration.cpp
   box/trunk/lib/common/DebugMemLeakFinder.cpp
   box/trunk/lib/common/Logging.h
   box/trunk/lib/common/PartialReadStream.cpp
   box/trunk/lib/common/Utils.cpp
   box/trunk/lib/compress/Compress.h
   box/trunk/lib/compress/CompressStream.cpp
   box/trunk/lib/crypto/CipherContext.cpp
   box/trunk/lib/intercept/intercept.cpp
   box/trunk/lib/raidfile/RaidFileWrite.cpp
   box/trunk/lib/server/ProtocolUncertainStream.cpp
Log:
Replace all remaining use of TRACEx() macros with logging framework.

Remove the old TRACEx macros to catch any remaining uses.


Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -1014,7 +1014,8 @@
 	// Delete the pending entries, if the map is entry
 	if(mpPendingEntries != 0 && mpPendingEntries->size() == 0)
 	{
-		TRACE1("Deleting mpPendingEntries from dir ID %lld\n", mObjectID);
+		BOX_TRACE("Deleting mpPendingEntries from dir ID " <<
+			BOX_FORMAT_OBJECTID(mObjectID));
 		delete mpPendingEntries;
 		mpPendingEntries = 0;
 	}
@@ -1249,8 +1250,8 @@
 						rLocalPath, 
 						dirname.GetClearFilename());
 
-					TRACE1("Deleted directory record for "
-						"%s\n", name.c_str());
+					BOX_TRACE("Deleted directory record "
+						"for " << name);
 				}				
 			}
 		}

Modified: box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp
===================================================================
--- box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -193,7 +193,8 @@
 	std::string line;
 	if(mInterProcessComms.GetLine(line, false /* no pre-processing */, MaximumWaitTime))
 	{
-		TRACE1("Housekeeping received command '%s' over interprocess comms\n", line.c_str());
+		BOX_TRACE("Housekeeping received command '" << line <<
+			"' over interprocess comms");
 	
 		int account = 0;
 	

Modified: box/trunk/bin/bbstored/BackupContext.cpp
===================================================================
--- box/trunk/bin/bbstored/BackupContext.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/bin/bbstored/BackupContext.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -382,7 +382,8 @@
 		// Mark that the store info should be saved as soon as possible
 		mSaveStoreInfoDelay = 0;
 		
-		TRACE1("When allocating object ID, found that %lld is already in use\n", id);
+		BOX_WARNING("When allocating object ID, found that " <<
+			BOX_FORMAT_OBJECTID(id) << " is already in use");
 	}
 	
 	THROW_EXCEPTION(BackupStoreException, CouldNotFindUnusedIDDuringAllocation)

Modified: box/trunk/lib/backupclient/BackupStoreFileDiff.cpp
===================================================================
--- box/trunk/lib/backupclient/BackupStoreFileDiff.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/backupclient/BackupStoreFileDiff.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -149,7 +149,7 @@
 	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 @@
 	{
 		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 @@
 			// 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 @@
 	
 	// 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 @@
 		#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 @@
 	
 	// 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 @@
 #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
 }

Modified: box/trunk/lib/backupclient/BackupStoreFilenameClear.cpp
===================================================================
--- box/trunk/lib/backupclient/BackupStoreFilenameClear.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/backupclient/BackupStoreFilenameClear.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -167,7 +167,8 @@
 	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 @@
 	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);

Modified: box/trunk/lib/backupclient/BackupStoreObjectDump.cpp
===================================================================
--- box/trunk/lib/backupclient/BackupStoreObjectDump.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/backupclient/BackupStoreObjectDump.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -47,7 +47,7 @@
 	}
 	if(ToTrace)
 	{
-		TRACE1("%s", text);
+		BOX_TRACE(text);
 	}
 }
 
@@ -211,14 +211,16 @@
 		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("======== ===== ==========");
 }
 

Modified: box/trunk/lib/backupstore/BackupStoreCheck.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreCheck.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/backupstore/BackupStoreCheck.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -268,7 +268,8 @@
 		}
 	
 		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

Modified: box/trunk/lib/backupstore/BackupStoreCheck2.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreCheck2.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/backupstore/BackupStoreCheck2.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -594,6 +594,8 @@
 	}
 }
 
+#define FMT_OID(x) BOX_FORMAT_OBJECTID(x)
+#define FMT_i      BOX_FORMAT_OBJECTID((*i)->GetObjectID())
 
 // --------------------------------------------------------------------------
 //
@@ -620,7 +622,11 @@
 				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 @@
 					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 @@
 			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 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 @@
 				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 @@
 				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 @@
 							&& ((*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 @@
 						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;
 						}

Modified: box/trunk/lib/backupstore/BackupStoreCheckData.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreCheckData.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/backupstore/BackupStoreCheckData.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -189,15 +189,18 @@
 	{
 		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"));
 		}
 	}
 }

Modified: box/trunk/lib/common/Box.h
===================================================================
--- box/trunk/lib/common/Box.h	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/common/Box.h	2008-03-29 01:56:39 UTC (rev 2119)
@@ -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

Modified: box/trunk/lib/common/Configuration.cpp
===================================================================
--- box/trunk/lib/common/Configuration.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/common/Configuration.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -208,8 +208,8 @@
 		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);

Modified: box/trunk/lib/common/DebugMemLeakFinder.cpp
===================================================================
--- box/trunk/lib/common/DebugMemLeakFinder.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/common/DebugMemLeakFinder.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -146,7 +146,9 @@
 	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 @@
 		}
 		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 @@
 		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);
 	}
 }
 

Modified: box/trunk/lib/common/Logging.h
===================================================================
--- box/trunk/lib/common/Logging.h	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/common/Logging.h	2008-03-29 01:56:39 UTC (rev 2119)
@@ -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 << \

Modified: box/trunk/lib/common/PartialReadStream.cpp
===================================================================
--- box/trunk/lib/common/PartialReadStream.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/common/PartialReadStream.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -44,7 +44,8 @@
 	// Warn in debug mode
 	if(mBytesLeft != 0)
 	{
-		TRACE1("PartialReadStream::~PartialReadStream when mBytesLeft = %d\n", mBytesLeft);
+		BOX_TRACE("PartialReadStream destroyed with " << mBytesLeft <<
+			" bytes remaining");
 	}
 }
 

Modified: box/trunk/lib/common/Utils.cpp
===================================================================
--- box/trunk/lib/common/Utils.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/common/Utils.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -53,10 +53,10 @@
 		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*/
 }

Modified: box/trunk/lib/compress/Compress.h
===================================================================
--- box/trunk/lib/compress/Compress.h	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/compress/Compress.h	2008-03-29 01:56:39 UTC (rev 2119)
@@ -52,10 +52,12 @@
 		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 @@
 		// Check errors
 		if(ret < 0)
 		{
-			TRACE1("zlib error code = %d\n", ret);			
+			BOX_WARNING("zlib error code = " << ret);			
 			THROW_EXCEPTION(CompressException, TransformFailed)
 		}
 		

Modified: box/trunk/lib/compress/CompressStream.cpp
===================================================================
--- box/trunk/lib/compress/CompressStream.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/compress/CompressStream.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -414,7 +414,7 @@
 	{
 		size *= 2;
 	}
-	TRACE1("Allocating CompressStream buffer, size %d\n", size);
+	BOX_TRACE("Allocating CompressStream buffer, size " << size);
 	mpBuffer = ::malloc(size);
 	if(mpBuffer == 0)
 	{

Modified: box/trunk/lib/crypto/CipherContext.cpp
===================================================================
--- box/trunk/lib/crypto/CipherContext.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/crypto/CipherContext.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -166,7 +166,8 @@
 	// 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 @@
 	// 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 @@
 	// 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 @@
 	// 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

Modified: box/trunk/lib/intercept/intercept.cpp
===================================================================
--- box/trunk/lib/intercept/intercept.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/intercept/intercept.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -375,12 +375,12 @@
 
 	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 @@
 	/*
 	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);
 	}
 	*/

Modified: box/trunk/lib/raidfile/RaidFileWrite.cpp
===================================================================
--- box/trunk/lib/raidfile/RaidFileWrite.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/raidfile/RaidFileWrite.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -96,7 +96,8 @@
 		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 @@
 	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 @@
 // --------------------------------------------------------------------------
 void RaidFileWrite::Close()
 {
-	TRACE0("Warning: RaidFileWrite::Close() called, discarding file\n");
+	BOX_WARNING("RaidFileWrite::Close() called, discarding file");
 	if(mOSFileHandle != -1)
 	{
 		Discard();

Modified: box/trunk/lib/server/ProtocolUncertainStream.cpp
===================================================================
--- box/trunk/lib/server/ProtocolUncertainStream.cpp	2008-03-29 01:55:29 UTC (rev 2118)
+++ box/trunk/lib/server/ProtocolUncertainStream.cpp	2008-03-29 01:56:39 UTC (rev 2119)
@@ -41,7 +41,8 @@
 {
 	if(!mFinished)
 	{
-		TRACE0("ProtocolUncertainStream::~ProtocolUncertainStream() destroyed when stream not complete\n");
+		BOX_WARNING("ProtocolUncertainStream destroyed before "
+			"stream finished");
 	}
 }