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/common | |
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/common')
-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 |
6 files changed, 25 insertions, 31 deletions
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*/ } |