Changeset 2119

Show
Ignore:
Timestamp:
29/03/2008 01:56:39 (9 months ago)
Author:
chris
Message:

Replace all remaining use of TRACEx() macros with logging framework.

Remove the old TRACEx macros to catch any remaining uses.

Location:
box/trunk
Files:
21 modified

Legend:

Unmodified
Added
Removed
  • box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp

    r2041 r2119  
    10151015        if(mpPendingEntries != 0 && mpPendingEntries->size() == 0) 
    10161016        { 
    1017                 TRACE1("Deleting mpPendingEntries from dir ID %lld\n", mObjectID); 
     1017                BOX_TRACE("Deleting mpPendingEntries from dir ID " << 
     1018                        BOX_FORMAT_OBJECTID(mObjectID)); 
    10181019                delete mpPendingEntries; 
    10191020                mpPendingEntries = 0; 
     
    12501251                                                dirname.GetClearFilename()); 
    12511252 
    1252                                         TRACE1("Deleted directory record for " 
    1253                                                 "%s\n", name.c_str()); 
     1253                                        BOX_TRACE("Deleted directory record " 
     1254                                                "for " << name); 
    12541255                                }                                
    12551256                        } 
  • box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp

    r1783 r2119  
    194194        if(mInterProcessComms.GetLine(line, false /* no pre-processing */, MaximumWaitTime)) 
    195195        { 
    196                 TRACE1("Housekeeping received command '%s' over interprocess comms\n", line.c_str()); 
     196                BOX_TRACE("Housekeeping received command '" << line << 
     197                        "' over interprocess comms"); 
    197198         
    198199                int account = 0; 
  • box/trunk/bin/bbstored/BackupContext.cpp

    r2079 r2119  
    383383                mSaveStoreInfoDelay = 0; 
    384384                 
    385                 TRACE1("When allocating object ID, found that %lld is already in use\n", id); 
     385                BOX_WARNING("When allocating object ID, found that " << 
     386                        BOX_FORMAT_OBJECTID(id) << " is already in use"); 
    386387        } 
    387388         
  • box/trunk/lib/backupclient/BackupStoreFileDiff.cpp

    r1940 r2119  
    150150        bool canDiffFromThis = false; 
    151151        LoadIndex(rDiffFromBlockIndex, DiffFromObjectID, &pindex, blocksInIndex, Timeout, canDiffFromThis); 
    152         //TRACE1("Diff: Blocks in index: %lld\n", blocksInIndex); 
     152        // BOX_TRACE("Diff: Blocks in index: " << blocksInIndex); 
    153153         
    154154        if(!canDiffFromThis) 
     
    440440                for(int t = 0; t < BACKUP_FILE_DIFF_MAX_BLOCK_SIZES; ++t) 
    441441                { 
    442                         TRACE3("Diff block size %d: %d (count = %lld)\n", t, Sizes[t], sizeCounts[t]); 
     442                        BOX_TRACE("Diff block size " << t << ": " << 
     443                                Sizes[t] << " (count = " <<  
     444                                sizeCounts[t] << ")"); 
    443445                } 
    444446        } 
     
    775777                        if(pHashTable[hash] != 0) 
    776778                        { 
    777                                 //TRACE1("Another hash entry for %d found\n", hash); 
     779                                //BOX_TRACE("Another hash entry for " << hash << " found"); 
    778780                                // Yes -- need to set the pointer in this entry to the current entry to build the linked list 
    779781                                pIndex[b].mpNextInHashList = pHashTable[hash]; 
     
    841843        // Then go through the entries in the hash list, comparing with the strong digest calculated 
    842844        scan = pFirstInHashList; 
    843         //TRACE0("second stage match\n"); 
     845        //BOX_TRACE("second stage match"); 
    844846        while(scan != 0) 
    845847        { 
    846                 //TRACE3("scan size %d, block size %d, hash %d\n", scan->mSize, BlockSize, Hash); 
     848                //BOX_TRACE("scan size " << scan->mSize << 
     849                //      ", block size " << BlockSize << 
     850                //      ", hash " << Hash); 
    847851                ASSERT(scan->mSize == BlockSize); 
    848852                ASSERT(RollingChecksum::ExtractHashingComponent(scan->mWeakChecksum) == DEBUG_Hash); 
     
    851855                if(strong.DigestMatches(scan->mStrongChecksum)) 
    852856                { 
    853                         //TRACE0("Match!\n"); 
     857                        //BOX_TRACE("Match!\n"); 
    854858                        // Found! Add to list of found blocks... 
    855859                        int64_t fileOffset = (FileBlockNumber * BlockSize) + Offset; 
     
    913917                if(BackupStoreFile::TraceDetailsOfDiffProcess) 
    914918                { 
    915                         TRACE1("Diff: Default recipe generated, %lld bytes of file\n", SizeOfInputFile); 
     919                        BOX_TRACE("Diff: Default recipe generated, " <<  
     920                                SizeOfInputFile << " bytes of file"); 
    916921                } 
    917922                #endif 
     
    10061011        // dump out the recipe 
    10071012#ifndef NDEBUG 
    1008         TRACE2("Diff: %lld new bytes found, %lld old blocks used\n", debug_NewBytesFound, debug_OldBlocksUsed); 
     1013        BOX_TRACE("Diff: " <<  
     1014                debug_NewBytesFound << " new bytes found, " << 
     1015                debug_OldBlocksUsed << " old blocks used"); 
    10091016        if(BackupStoreFile::TraceDetailsOfDiffProcess) 
    10101017        { 
    1011                 TRACE1("Diff: Recipe generated (size %d)\n======== ========= ========\nSpace b4 FirstBlk  NumBlks\n", rRecipe.size()); 
     1018                BOX_TRACE("Diff: Recipe generated (size " << rRecipe.size()); 
     1019                BOX_TRACE("======== ========= ========"); 
     1020                BOX_TRACE("Space b4 FirstBlk  NumBlks"); 
    10121021                { 
    10131022                        for(unsigned int e = 0; e < rRecipe.size(); ++e) 
     
    10191028                                sprintf(b, "%8lld", (int64_t)(rRecipe[e].mpStartBlock - pIndex)); 
    10201029#endif 
    1021                                 TRACE3("%8lld %s %8lld\n", rRecipe[e].mSpaceBefore, (rRecipe[e].mpStartBlock == 0)?"       -":b, (int64_t)rRecipe[e].mBlocks); 
    1022                         } 
    1023                 } 
    1024                 TRACE0("======== ========= ========\n"); 
     1030                                BOX_TRACE(std::setw(8) << 
     1031                                        rRecipe[e].mSpaceBefore << 
     1032                                        " " << 
     1033                                        ((rRecipe[e].mpStartBlock == 0)?"       -":b) << 
     1034                                        " " << std::setw(8) << 
     1035                                        rRecipe[e].mBlocks); 
     1036                        } 
     1037                } 
     1038                BOX_TRACE("======== ========= ========"); 
    10251039        } 
    10261040#endif 
  • box/trunk/lib/backupclient/BackupStoreFilenameClear.cpp

    r1471 r2119  
    168168        { 
    169169        case Encoding_Clear: 
    170                 TRACE0("**** BackupStoreFilename encoded with Clear encoding ****\n"); 
     170                BOX_TRACE("**** BackupStoreFilename encoded with " 
     171                        "Clear encoding ****"); 
    171172                mClearFilename.assign(c_str() + 2, size - 2); 
    172173                break; 
     
    194195        { 
    195196#ifndef WIN32 
    196                 TRACE1("Allocating filename encoding/decoding buffer with size %d\n", BufSize); 
     197                BOX_TRACE("Allocating filename encoding/decoding buffer " 
     198                        "with size " << BufSize); 
    197199#endif 
    198200                spEncDecBuffer = new MemoryBlockGuard<uint8_t *>(BufSize); 
  • box/trunk/lib/backupclient/BackupStoreObjectDump.cpp

    r879 r2119  
    4848        if(ToTrace) 
    4949        { 
    50                 TRACE1("%s", text); 
     50                BOX_TRACE(text); 
    5151        } 
    5252} 
     
    212212                { 
    213213                        nnew++; 
    214                         TRACE2("%8lld this  s=%8lld\n", b, s); 
     214                        BOX_TRACE(std::setw(8) << b << " this  s=" << 
     215                                std::setw(8) << s); 
    215216                } 
    216217                else 
    217218                { 
    218219                        nold++; 
    219                         TRACE2("%8lld other i=%8lld\n", b, 0 - s);               
    220                 } 
    221         } 
    222         TRACE0("======== ===== ==========\n"); 
     220                        BOX_TRACE(std::setw(8) << b << " other i=" << 
     221                                std::setw(8) << 0 - s); 
     222                } 
     223        } 
     224        BOX_TRACE("======== ===== =========="); 
    223225} 
    224226 
  • box/trunk/lib/backupstore/BackupStoreCheck.cpp

    r1789 r2119  
    269269         
    270270                maxDir = CheckObjectsScanDir(0, 1, mStoreRoot); 
    271                 TRACE1("Max dir starting ID is %llx\n", maxDir); 
     271                BOX_TRACE("Max dir starting ID is " << 
     272                        BOX_FORMAT_OBJECTID(maxDir)); 
    272273        } 
    273274         
  • box/trunk/lib/backupstore/BackupStoreCheck2.cpp

    r1789 r2119  
    595595} 
    596596 
     597#define FMT_OID(x) BOX_FORMAT_OBJECTID(x) 
     598#define FMT_i      BOX_FORMAT_OBJECTID((*i)->GetObjectID()) 
    597599 
    598600// -------------------------------------------------------------------------- 
     
    621623                                { 
    622624                                        // Depends on something, but it isn't there. 
    623                                         TRACE2("Entry id %llx removed because depends on newer version %llx which doesn't exist\n", (*i)->GetObjectID(), dependsNewer); 
     625                                        BOX_TRACE("Entry id " << FMT_i << 
     626                                                " removed because depends " 
     627                                                "on newer version " << 
     628                                                FMT_OID(dependsNewer) << 
     629                                                " which doesn't exist"); 
    624630                                         
    625631                                        // Remove 
     
    639645                                        { 
    640646                                                // Wrong entry 
    641                                                 TRACE3("Entry id %llx, correcting DependsOlder to %llx, was %llx\n", dependsNewer, (*i)->GetObjectID(), newerEn->GetDependsOlder()); 
     647                                                BOX_TRACE("Entry id " << 
     648                                                        FMT_OID(dependsNewer) << 
     649                                                        ", correcting DependsOlder to " << 
     650                                                        FMT_i << 
     651                                                        ", was " << 
     652                                                        FMT_OID(newerEn->GetDependsOlder())); 
    642653                                                newerEn->SetDependsOlder((*i)->GetObjectID()); 
    643654                                                // Mark as changed 
     
    658669                        { 
    659670                                // Has an older version marked, but this doesn't exist. Remove this mark 
    660                                 TRACE2("Entry id %llx was marked that %llx depended on it, which doesn't exist, dependency info cleared\n", (*i)->GetObjectID(), dependsOlder); 
     671                                BOX_TRACE("Entry id " << FMT_i << 
     672                                        " was marked as depended on by " << 
     673                                        FMT_OID(dependsOlder) << ", " 
     674                                        "which doesn't exist, dependency " 
     675                                        "info cleared"); 
    661676 
    662677                                (*i)->SetDependsOlder(0); 
     
    694709                        if((*i) == 0) 
    695710                        { 
    696                                 TRACE0("Remove because null pointer found\n"); 
     711                                BOX_TRACE("Remove because null pointer found"); 
    697712                                removeEntry = true; 
    698713                        } 
     
    705720                                { 
    706721                                        // Bad! Unset the file flag 
    707                                         TRACE1("Entry %llx: File flag set when dir flag set\n", (*i)->GetObjectID()); 
     722                                        BOX_TRACE("Entry " << FMT_i << 
     723                                                ": File flag and dir flag both set"); 
    708724                                        (*i)->RemoveFlags(Entry::Flags_File); 
    709725                                        changed = true; 
     
    714730                                { 
    715731                                        // ID already seen, or type doesn't match 
    716                                         TRACE1("Entry %llx: Remove because ID already seen\n", (*i)->GetObjectID()); 
     732                                        BOX_TRACE("Entry " << FMT_i << 
     733                                                ": Remove because ID already seen"); 
    717734                                        removeEntry = true; 
    718735                                } 
     
    731748                                                { 
    732749                                                        // Not set, set it 
    733                                                         TRACE1("Entry %llx: Set old flag\n", (*i)->GetObjectID()); 
     750                                                        BOX_TRACE("Entry " << FMT_i << 
     751                                                                ": Set old flag"); 
    734752                                                        (*i)->AddFlags(Entry::Flags_OldVersion); 
    735753                                                        changed = true; 
     
    742760                                                { 
    743761                                                        // Set, unset it 
    744                                                         TRACE1("Entry %llx: Old flag unset\n", (*i)->GetObjectID()); 
     762                                                        BOX_TRACE("Entry " << FMT_i << 
     763                                                                ": Old flag unset"); 
    745764                                                        (*i)->RemoveFlags(Entry::Flags_OldVersion); 
    746765                                                        changed = true; 
  • box/trunk/lib/backupstore/BackupStoreCheckData.cpp

    r217 r2119  
    190190                IDBlock *pblock = i->second; 
    191191                int32_t bentries = (pblock == mpInfoLastBlock)?mInfoLastBlockEntries:BACKUPSTORECHECK_BLOCK_SIZE; 
    192                 TRACE2("BLOCK @ 0x%08x, %d entries\n", pblock, bentries); 
     192                BOX_TRACE("BLOCK @ " << BOX_FORMAT_HEX32(pblock) << 
     193                        ", " << bentries << " entries"); 
    193194                 
    194195                for(int e = 0; e < bentries; ++e) 
    195196                { 
    196197                        uint8_t flags = GetFlags(pblock, e); 
    197                         TRACE4("id %llx, c %llx, %s, %s\n", 
    198                                 pblock->mID[e], pblock->mContainer[e], 
    199                                 (flags & Flags_IsDir)?"dir":"file", 
    200                                 (flags & Flags_IsContained)?"contained":"unattached"); 
     198                        BOX_TRACE(std::hex <<  
     199                                "id "  << pblock->mID[e] << 
     200                                ", c " << pblock->mContainer[e] << 
     201                                ", " << ((flags & Flags_IsDir)?"dir":"file") << 
     202                                ", " << ((flags & Flags_IsContained) ?  
     203                                        "contained":"unattached")); 
    201204                } 
    202205        } 
  • box/trunk/lib/common/Box.h

    r2050 r2119  
    5353        int BoxDebug_printf(const char *format, ...); 
    5454        int BoxDebugTrace(const char *format, ...); 
    55         #define TRACE0(msg) {BoxDebugTrace("%s", msg);} 
    56         #define TRACE1(msg, a0) {BoxDebugTrace(msg, a0);} 
    57         #define TRACE2(msg, a0, a1) {BoxDebugTrace(msg, a0, a1);} 
    58         #define TRACE3(msg, a0, a1, a2) {BoxDebugTrace(msg, a0, a1, a2);} 
    59         #define TRACE4(msg, a0, a1, a2, a3) {BoxDebugTrace(msg, a0, a1, a2, a3);} 
    60         #define TRACE5(msg, a0, a1, a2, a3, a4) {BoxDebugTrace(msg, a0, a1, a2, a3, a4);} 
    61         #define TRACE6(msg, a0, a1, a2, a3, a4, a5) {BoxDebugTrace(msg, a0, a1, a2, a3, a4, a5);} 
    62         #define TRACE7(msg, a0, a1, a2, a3, a4, a5, a6) {BoxDebugTrace(msg, a0, a1, a2, a3, a4, a5, a6);} 
    63         #define TRACE8(msg, a0, a1, a2, a3, a4, a5, a6, a7) {BoxDebugTrace(msg, a0, a1, a2, a3, a4, a5, a6, a7);} 
    6455         
    6556        #ifndef PLATFORM_DISABLE_MEM_LEAK_TESTING 
     
    7768        #define TRACE_TO_STDOUT(x) {} 
    7869 
    79         #define TRACE0(msg) 
    80         #define TRACE1(msg, a0) 
    81         #define TRACE2(msg, a0, a1) 
    82         #define TRACE3(msg, a0, a1, a2) 
    83         #define TRACE4(msg, a0, a1, a2, a3) 
    84         #define TRACE5(msg, a0, a1, a2, a3, a4) 
    85         #define TRACE6(msg, a0, a1, a2, a3, a4, a5) 
    86         #define TRACE7(msg, a0, a1, a2, a3, a4, a5, a6) 
    87         #define TRACE8(msg, a0, a1, a2, a3, a4, a5, a6, a7) 
    88          
    8970        // Box Backup builds release get extra information for exception logging 
    9071        #define EXCEPTION_CODENAMES_EXTENDED 
  • box/trunk/lib/common/Configuration.cpp

    r2116 r2119  
    209209                { 
    210210                        // An error occured, return now 
    211                         //TRACE1("Error message from LoadInto: %s", rErrorMsg.c_str()); 
    212                         TRACE0("Error at Configuration::LoadInfo\n"); 
     211                        BOX_ERROR("Error in Configuration::LoadInfo: " <<  
     212                                rErrorMsg); 
    213213                        delete pconfig; 
    214214                        pconfig = 0; 
  • box/trunk/lib/common/DebugMemLeakFinder.cpp

    r2053 r2119  
    147147        if(ptr && i == sMallocBlocks.end()) 
    148148        { 
    149                 TRACE1("Block %x realloc(), but not in list. Error? Or allocated in startup static objects?\n", ptr); 
     149                BOX_WARNING("Block " << ptr << " realloc()ated, but not " 
     150                        "in list. Error? Or allocated in startup static " 
     151                        "objects?"); 
    150152        } 
    151153 
     
    194196                else 
    195197                { 
    196                         TRACE1("Block %p freed, but not known. Error? Or allocated in startup static allocation?\n", ptr); 
     198                        BOX_WARNING("Block " << ptr << " freed, but not " 
     199                                "known. Error? Or allocated in startup " 
     200                                "static allocation?"); 
    197201                } 
    198202 
     
    294298                if(i == sMallocBlocks.end()) 
    295299                { 
    296                         TRACE0("Logical error in section block finding\n"); 
     300                        BOX_WARNING("Logical error in section block finding"); 
    297301                } 
    298302                else 
    299303                { 
    300                         TRACE4("Block %p size %d allocated at %s:%d\n", i->first, i->second.size, i->second.file, i->second.line); 
     304                        BOX_TRACE("Block " << i->first << " size " << 
     305                                i->second.size << " allocated at " << 
     306                                i->second.file << ":" << i->second.line); 
    301307                } 
    302308        } 
    303309        for(std::map<void *, ObjectInfo>::const_iterator i(sSectionObjectBlocks.begin()); i != sSectionObjectBlocks.end(); ++i) 
    304310        { 
    305                 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); 
     311                BOX_TRACE("Object" << (i->second.array?" []":"") << " " << 
     312                        i->first << " size " << i->second.size << 
     313                        " allocated at " << i->second.file <<  
     314                        ":" << i->second.line); 
    306315        } 
    307316} 
  • box/trunk/lib/common/Logging.h

    r2115 r2119  
    6363#endif 
    6464 
    65 #define BOX_FORMAT_ACCOUNT(accno) \ 
     65#define BOX_FORMAT_HEX32(number) \ 
    6666        std::hex << \ 
    6767        std::showbase << \ 
     
    6969        std::setw(10) << \ 
    7070        std::setfill('0') << \ 
    71         (accno) << \ 
     71        (number) << \ 
    7272        std::dec 
     73 
     74#define BOX_FORMAT_ACCOUNT(accno) \ 
     75        BOX_FORMAT_HEX32(accno) 
    7376 
    7477#define BOX_FORMAT_OBJECTID(objectid) \ 
  • box/trunk/lib/common/PartialReadStream.cpp

    r1586 r2119  
    4545        if(mBytesLeft != 0) 
    4646        { 
    47                 TRACE1("PartialReadStream::~PartialReadStream when mBytesLeft = %d\n", mBytesLeft); 
     47                BOX_TRACE("PartialReadStream destroyed with " << mBytesLeft << 
     48                        " bytes remaining"); 
    4849        } 
    4950} 
  • box/trunk/lib/common/Utils.cpp

    r1923 r2119  
    5454        } 
    5555/*#ifndef NDEBUG 
    56         TRACE2("Splitting string '%s' on %c\n", String.c_str(), SplitOn); 
     56        BOX_TRACE("Splitting string '" << String << " on " << (char)SplitOn); 
    5757        for(unsigned int l = 0; l < rOutput.size(); ++l) 
    5858        { 
    59                 TRACE2("%d = '%s'\n", l, rOutput[l].c_str()); 
     59                BOX_TRACE(l << " = '" << rOutput[l] << "'"); 
    6060        } 
    6161#endif*/ 
  • box/trunk/lib/compress/Compress.h

    r1868 r2119  
    5353                        :(inflateEnd(&mStream)))) != Z_OK) 
    5454                { 
    55                         TRACE1("zlib error code = %d\n", r); 
     55                        BOX_WARNING("zlib error code = " << r); 
    5656                        if(r == Z_DATA_ERROR) 
    5757                        { 
    58                                 TRACE0("WARNING: End of compress/decompress without all input being consumed -- possible corruption?\n"); 
     58                                BOX_WARNING("End of compress/decompress "