From: Alex Rousskov Date: Tue, 6 Sep 2011 21:07:13 +0000 (-0600) Subject: Polished debugging messages to use DBG_IMPORTANT, WARNING, etc. X-Git-Tag: take08~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=51618c6abd19131aabcd04399765e5563e2fee15;p=thirdparty%2Fsquid.git Polished debugging messages to use DBG_IMPORTANT, WARNING, etc. --- diff --git a/src/fs/rock/RockRebuild.cc b/src/fs/rock/RockRebuild.cc index 6becb797cc..ff4c5b84bc 100644 --- a/src/fs/rock/RockRebuild.cc +++ b/src/fs/rock/RockRebuild.cc @@ -138,16 +138,16 @@ Rock::Rebuild::doOneEntry() { // get our header DbCellHeader header; if (buf.contentSize() < static_cast(sizeof(header))) { - debugs(47, 1, "cache_dir[" << sd->index << "]: " << - "truncated swap entry meta data at " << dbOffset); + debugs(47, DBG_IMPORTANT, "WARNING: cache_dir[" << sd->index << "]: " << + "Ignoring truncated cache entry meta data at " << dbOffset); counts.invalid++; return; } memcpy(&header, buf.content(), sizeof(header)); if (!header.sane()) { - debugs(47, 1, "cache_dir[" << sd->index << "]: " << - "malformed rock db cell header at " << dbOffset); + debugs(47, DBG_IMPORTANT, "WARNING: cache_dir[" << sd->index << "]: " << + "Ignoring malformed cache entry meta data at " << dbOffset); counts.invalid++; return; } diff --git a/src/fs/rock/RockSwapDir.cc b/src/fs/rock/RockSwapDir.cc index 4532873e4c..1ea7fd7b20 100644 --- a/src/fs/rock/RockSwapDir.cc +++ b/src/fs/rock/RockSwapDir.cc @@ -147,14 +147,14 @@ Rock::SwapDir::create() struct stat swap_sb; if (::stat(path, &swap_sb) < 0) { - debugs (47, 1, "Creating Rock db directory: " << path); + debugs (47, DBG_IMPORTANT, "Creating Rock db directory: " << path); #ifdef _SQUID_MSWIN_ const int res = mkdir(path); #else const int res = mkdir(path, 0700); #endif if (res != 0) { - debugs(47,0, "Failed to create Rock db dir " << path << + debugs(47, DBG_CRITICAL, "Failed to create Rock db dir " << path << ": " << xstrerror()); fatal("Rock Store db creation error"); } @@ -219,7 +219,8 @@ Rock::SwapDir::init() io = m->createStrategy(); io->init(); } else { - debugs(47,1, "Rock store is missing DiskIO module: " << ioModule); + debugs(47, DBG_CRITICAL, "FATAL: Rock store is missing DiskIO module: " << + ioModule); fatal("Rock Store missing a required DiskIO module"); } @@ -485,19 +486,14 @@ Rock::SwapDir::openStoreIO(StoreEntry &e, StoreIOState::STFNCB *cbFile, StoreIOS void Rock::SwapDir::ioCompletedNotification() { - if (!theFile) { - debugs(47, 1, HERE << filePath << ": initialization failure or " << - "premature close of rock db file"); + if (!theFile) fatalf("Rock cache_dir failed to initialize db file: %s", filePath); - } - if (theFile->error()) { - debugs(47, 1, HERE << filePath << ": " << xstrerror()); - fatalf("Rock cache_dir failed to open db file: %s", filePath); - } + if (theFile->error()) + fatalf("Rock cache_dir at %s failed to open db file: %s", filePath, + xstrerror()); - // TODO: lower debugging level - debugs(47,1, "Rock cache_dir[" << index << "] limits: " << + debugs(47, 2, "Rock cache_dir[" << index << "] limits: " << std::setw(12) << maxSize() << " disk bytes and " << std::setw(7) << map->entryLimit() << " entries"); @@ -562,8 +558,8 @@ Rock::SwapDir::full() const // but it should not happen for us void Rock::SwapDir::diskFull() { - debugs(20,1, "Internal ERROR: No space left error with rock cache_dir: " << - filePath); + debugs(20, DBG_IMPORTANT, "Internal ERROR: No space left with " << + "rock cache_dir: " << filePath); } /// purge while full(); it should be sufficient to purge just one diff --git a/src/main.cc b/src/main.cc index 1d9c178228..bd83f522b4 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1246,10 +1246,11 @@ SquidMainSafe(int argc, char **argv) try { return SquidMain(argc, argv); } catch (const std::exception &e) { - debugs(0,0, "dying from an unhandled exception: " << e.what()); + debugs(1, DBG_CRITICAL, "FATAL: dying from an unhandled exception: " << + e.what()); throw; } catch (...) { - debugs(0,0, "dying from an unhandled exception."); + debugs(1, DBG_CRITICAL, "FATAL: dying from an unhandled exception."); throw; } return -1; // not reached