Ignore:
Timestamp:
01/08/2007 00:18:50 (5 years ago)
Author:
chris
Message:

Replace almost all calls to syslog() with logging framework. (merges [1783])

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/chris/general/bin/bbstored/HousekeepStoreAccount.cpp

    r1321 r1784  
    1010#include "Box.h" 
    1111 
     12#include <stdio.h> 
     13 
    1214#include <map> 
    13 #include <stdio.h> 
    1415 
    1516#include "HousekeepStoreAccount.h" 
     
    138139                { 
    139140                        // Log this 
    140                         ::syslog(LOG_ERR, "On housekeeping, sizes in store do not match calculated sizes, correcting"); 
    141                         ::syslog(LOG_ERR, "different (store,calc): acc 0x%08x, used (%lld,%lld), old (%lld,%lld), deleted (%lld,%lld), dirs (%lld,%lld)", 
    142                                 mAccountID, 
    143                                 (used + mBlocksUsedDelta), mBlocksUsed, (usedOld + mBlocksInOldFilesDelta), mBlocksInOldFiles, 
    144                                 (usedDeleted + mBlocksInDeletedFilesDelta), mBlocksInDeletedFiles, usedDirectories, mBlocksInDirectories); 
     141                        BOX_ERROR("Housekeeping on account " <<  
     142                                BOX_FORMAT_ACCOUNT(mAccountID) << " found " 
     143                                "and fixed wrong block counts: " 
     144                                "used (" << 
     145                                (used + mBlocksUsedDelta) << "," << 
     146                                mBlocksUsed << "), old (" << 
     147                                (usedOld + mBlocksInOldFilesDelta) << "," << 
     148                                mBlocksInOldFiles << "), deleted (" << 
     149                                (usedDeleted + mBlocksInDeletedFilesDelta) << 
     150                                "," << mBlocksInDeletedFiles << "), dirs (" << 
     151                                usedDirectories << "," << mBlocksInDirectories 
     152                                << ")"); 
    145153                } 
    146154                 
     
    174182        if(mFilesDeleted > 0 || mEmptyDirectoriesDeleted > 0) 
    175183        { 
    176                 ::syslog(LOG_INFO, "Account 0x%08x, removed %lld blocks (%lld files, %lld dirs)%s", mAccountID, 0 - (mBlocksUsedDelta + removeASAPBlocksUsedDelta), 
    177                         mFilesDeleted, mEmptyDirectoriesDeleted, 
    178                         deleteInterrupted?" was interrupted":""); 
     184                BOX_INFO("Housekeeping on account " <<  
     185                        BOX_FORMAT_ACCOUNT(mAccountID) << " " 
     186                        "removed " << 
     187                        (0 - (mBlocksUsedDelta + removeASAPBlocksUsedDelta)) << 
     188                        " blocks (" << mFilesDeleted << " files, " << 
     189                        mEmptyDirectoriesDeleted << " dirs)" << 
     190                        (deleteInterrupted?" and was interrupted":"")); 
    179191        } 
    180192         
    181193        // Make sure the delta's won't cause problems if the counts are really wrong, and 
    182194        // it wasn't fixed because the store was updated during the scan. 
    183         if(mBlocksUsedDelta                     < (0 - info->GetBlocksUsed()))                          mBlocksUsedDelta =                      (0 - info->GetBlocksUsed()); 
    184         if(mBlocksInOldFilesDelta               < (0 - info->GetBlocksInOldFiles()))            mBlocksInOldFilesDelta =        (0 - info->GetBlocksInOldFiles()); 
    185         if(mBlocksInDeletedFilesDelta   < (0 - info->GetBlocksInDeletedFiles()))        mBlocksInDeletedFilesDelta =(0 - info->GetBlocksInDeletedFiles()); 
    186         if(mBlocksInDirectoriesDelta    < (0 - info->GetBlocksInDirectories()))         mBlocksInDirectoriesDelta = (0 - info->GetBlocksInDirectories()); 
     195        if(mBlocksUsedDelta < (0 - info->GetBlocksUsed())) 
     196        { 
     197                mBlocksUsedDelta = (0 - info->GetBlocksUsed()); 
     198        } 
     199        if(mBlocksInOldFilesDelta < (0 - info->GetBlocksInOldFiles())) 
     200        { 
     201                mBlocksInOldFilesDelta = (0 - info->GetBlocksInOldFiles()); 
     202        } 
     203        if(mBlocksInDeletedFilesDelta < (0 - info->GetBlocksInDeletedFiles())) 
     204        { 
     205                mBlocksInDeletedFilesDelta = (0 - info->GetBlocksInDeletedFiles()); 
     206        } 
     207        if(mBlocksInDirectoriesDelta < (0 - info->GetBlocksInDirectories())) 
     208        { 
     209                mBlocksInDirectoriesDelta = (0 - info->GetBlocksInDirectories()); 
     210        } 
    187211         
    188212        // Update the usage counts in the store 
     
    555579                if(pentry == 0) 
    556580                { 
    557                         ::syslog(LOG_ERR, "acc 0x%08x, object %lld not found in dir %lld, logic error/corruption? Run bbstoreaccounts check <accid> fix", mAccountID, ObjectID, InDirectory); 
     581                        BOX_ERROR("Housekeeping on account " << 
     582                                BOX_FORMAT_ACCOUNT(mAccountID) << " " 
     583                                "found error: object " << 
     584                                BOX_FORMAT_OBJECTID(ObjectID) << " " 
     585                                "not found in dir " <<  
     586                                BOX_FORMAT_OBJECTID(InDirectory) << ", " 
     587                                "indicates logic error/corruption? Run " 
     588                                "bbstoreaccounts check <accid> fix"); 
    558589                        return; 
    559590                } 
Note: See TracChangeset for help on using the changeset viewer.