Skip to content

Commit

Permalink
log debug define
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Feb 27, 2024
1 parent bab5ebb commit 549585a
Show file tree
Hide file tree
Showing 57 changed files with 216 additions and 216 deletions.
2 changes: 1 addition & 1 deletion src/fdb5/LibFdb5.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static unsigned getUserEnvRemoteProtocol() {
static unsigned fdbRemoteProtocolVersion =
eckit::Resource<unsigned>("fdbRemoteProtocolVersion;$FDB5_REMOTE_PROTOCOL_VERSION", 0);
if (fdbRemoteProtocolVersion) {
eckit::Log::debug() << "fdbRemoteProtocolVersion overidde to version: " << fdbRemoteProtocolVersion
LOG_DEBUG_LIB(LibFdb5) << "fdbRemoteProtocolVersion overidde to version: " << fdbRemoteProtocolVersion
<< std::endl;
}
return 0; // no version override
Expand Down
36 changes: 18 additions & 18 deletions src/fdb5/api/DistFDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,21 @@ void DistFDB::archive(const Key& key, const void* data, size_t length) {

std::vector<size_t> laneIndices;

//Log::debug<LibFdb5>() << "Number of lanes: " << lanes_.size() << std::endl;
//Log::debug<LibFdb5>() << "Lane indices: ";
//for (const auto& i : laneIndices) Log::debug<LibFdb5>() << i << ", ";
//Log::debug<LibFdb5>() << std::endl;
//LOG_DEBUG_LIB(LibFdb5) << "Number of lanes: " << lanes_.size() << std::endl;
//LOG_DEBUG_LIB(LibFdb5) << "Lane indices: ";
//for (const auto& i : laneIndices) LOG_DEBUG_LIB(LibFdb5) << i << ", ";
//LOG_DEBUG_LIB(LibFdb5) << std::endl;

hash_.hashOrder(key.keyDict(), laneIndices);

//Log::debug<LibFdb5>() << "Number of lanes: " << lanes_.size() << std::endl;
//Log::debug<LibFdb5>() << "Lane indices: ";
//for (const auto& i : laneIndices) Log::debug<LibFdb5>() << i << ", ";
//Log::debug<LibFdb5>() << std::endl;
//LOG_DEBUG_LIB(LibFdb5) << "Number of lanes: " << lanes_.size() << std::endl;
//LOG_DEBUG_LIB(LibFdb5) << "Lane indices: ";
//for (const auto& i : laneIndices) LOG_DEBUG_LIB(LibFdb5) << i << ", ";
//LOG_DEBUG_LIB(LibFdb5) << std::endl;

// Given an order supplied by the Rendezvous hash, try the FDB in order until
// one works. n.b. Errors are unacceptable once the FDB is dirty.
Log::debug<LibFdb5>() << "Attempting dist FDB archive" << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "Attempting dist FDB archive" << std::endl;

decltype(laneIndices)::const_iterator it = laneIndices.begin();
decltype(laneIndices)::const_iterator end = laneIndices.end();
Expand Down Expand Up @@ -180,55 +180,55 @@ auto DistFDB::queryInternal(const FDBToolRequest& request, const QueryFN& fn) ->


ListIterator DistFDB::list(const FDBToolRequest& request) {
Log::debug<LibFdb5>() << "DistFDB::list() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "DistFDB::list() : " << request << std::endl;
return queryInternal(request,
[](FDB& fdb, const FDBToolRequest& request) {
return fdb.list(request);
});
}

ListIterator DistFDB::inspect(const metkit::mars::MarsRequest& request) {
Log::debug<LibFdb5>() << "DistFDB::inspect() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "DistFDB::inspect() : " << request << std::endl;
return queryInternal(request,
[](FDB& fdb, const FDBToolRequest& request) {
return fdb.inspect(request.request());
});
}

DumpIterator DistFDB::dump(const FDBToolRequest& request, bool simple) {
Log::debug<LibFdb5>() << "DistFDB::dump() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "DistFDB::dump() : " << request << std::endl;
return queryInternal(request,
[simple](FDB& fdb, const FDBToolRequest& request) {
return fdb.dump(request, simple);
});
}

StatusIterator DistFDB::status(const FDBToolRequest& request) {
Log::debug<LibFdb5>() << "DistFDB::status() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "DistFDB::status() : " << request << std::endl;
return queryInternal(request,
[](FDB& fdb, const FDBToolRequest& request) {
return fdb.status(request);
});
}

WipeIterator DistFDB::wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) {
Log::debug<LibFdb5>() << "DistFDB::wipe() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "DistFDB::wipe() : " << request << std::endl;
return queryInternal(request,
[doit, porcelain, unsafeWipeAll](FDB& fdb, const FDBToolRequest& request) {
return fdb.wipe(request, doit, porcelain, unsafeWipeAll);
});
}

PurgeIterator DistFDB::purge(const FDBToolRequest& request, bool doit, bool porcelain) {
Log::debug<LibFdb5>() << "DistFDB::purge() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "DistFDB::purge() : " << request << std::endl;
return queryInternal(request,
[doit, porcelain](FDB& fdb, const FDBToolRequest& request) {
return fdb.purge(request, doit, porcelain);
});
}

StatsIterator DistFDB::stats(const FDBToolRequest &request) {
Log::debug<LibFdb5>() << "DistFDB::stats() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "DistFDB::stats() : " << request << std::endl;
return queryInternal(request,
[](FDB& fdb, const FDBToolRequest& request) {
return fdb.stats(request);
Expand All @@ -238,7 +238,7 @@ StatsIterator DistFDB::stats(const FDBToolRequest &request) {
ControlIterator DistFDB::control(const FDBToolRequest& request,
ControlAction action,
ControlIdentifiers identifiers) {
Log::debug<LibFdb5>() << "DistFDB::control() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "DistFDB::control() : " << request << std::endl;
return queryInternal(request,
[action, identifiers](FDB& fdb, const FDBToolRequest& request) {
return fdb.control(request, action, identifiers);
Expand All @@ -247,7 +247,7 @@ ControlIterator DistFDB::control(const FDBToolRequest& request,


MoveIterator DistFDB::move(const FDBToolRequest& request, const eckit::URI& dest) {
Log::debug<LibFdb5>() << "DistFDB::move() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "DistFDB::move() : " << request << std::endl;
return queryInternal(request,
[dest](FDB& fdb, const FDBToolRequest& request) {
return fdb.move(request, dest);
Expand Down
6 changes: 3 additions & 3 deletions src/fdb5/api/FDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void FDB::archive(const metkit::mars::MarsRequest& request, eckit::DataHandle& h
ss << "FDB archive - found unexpected message" << std::endl;
ss << " user request:" << std::endl << " " << request << std::endl;
ss << " unexpected message:" << std::endl << " " << key << std::endl;
eckit::Log::debug<LibFdb5>() << ss.str();
LOG_DEBUG_LIB(LibFdb5) << ss.str();
throw eckit::UserError(ss.str(), Here());
}
archive(key, msg.data(), msg.length());
Expand All @@ -91,7 +91,7 @@ void FDB::archive(const metkit::mars::MarsRequest& request, eckit::DataHandle& h
for (auto vacantRequest : cube.vacantRequests()) {
ss << " " << vacantRequest << std::endl;
}
eckit::Log::debug<LibFdb5>() << ss.str();
LOG_DEBUG_LIB(LibFdb5) << ss.str();
throw eckit::UserError(ss.str(), Here());
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ bool FDB::sorted(const metkit::mars::MarsRequest &request) {
eckit::Log::userInfo() << "Using optimise" << std::endl;
}

eckit::Log::debug<LibFdb5>() << "fdb5::FDB::retrieve() Sorted? " << sorted << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "fdb5::FDB::retrieve() Sorted? " << sorted << std::endl;

return sorted;
}
Expand Down
6 changes: 3 additions & 3 deletions src/fdb5/api/FDBFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ FDBBase::FDBBase(const Config& config, const std::string& name) :
controlIdentifiers_ |= ControlIdentifier::Wipe;
}

eckit::Log::debug<LibFdb5>() << "FDBBase: " << config << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "FDBBase: " << config << std::endl;
}


Expand Down Expand Up @@ -114,7 +114,7 @@ std::unique_ptr<FDBBase> FDBFactory::build(const Config& config) {

std::string key = actualConfig.getString("type", "local");

eckit::Log::debug<LibFdb5>() << "Selecting FDB implementation: " << key << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "Selecting FDB implementation: " << key << std::endl;

eckit::AutoLock<eckit::Mutex> lock(mutex_);

Expand All @@ -127,7 +127,7 @@ std::unique_ptr<FDBBase> FDBFactory::build(const Config& config) {
}

std::unique_ptr<FDBBase> ret = it->second->make(actualConfig);
eckit::Log::debug<LibFdb5>() << "Constructed FDB implementation: " << *ret << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "Constructed FDB implementation: " << *ret << std::endl;
return ret;
}

Expand Down
6 changes: 3 additions & 3 deletions src/fdb5/api/FDBStats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void FDBStats::addArchive(size_t length, eckit::Timer& timer, size_t nfields) {
elapsedArchive_ += elapsed;
sumArchiveTimingSquared_ += elapsed * elapsed;

Log::debug<LibFdb5>() << "Archive count: " << numArchive_
LOG_DEBUG_LIB(LibFdb5) << "Archive count: " << numArchive_
<< ", size: " << Bytes(length)
<< ", total: " << Bytes(bytesArchive_)
<< ", time: " << Seconds(elapsed)
Expand All @@ -92,7 +92,7 @@ void FDBStats::addRetrieve(size_t length, eckit::Timer& timer) {
elapsedRetrieve_ += elapsed;
sumRetrieveTimingSquared_ += elapsed * elapsed;

Log::debug<LibFdb5>() << "Retrieve count: " << numRetrieve_
LOG_DEBUG_LIB(LibFdb5) << "Retrieve count: " << numRetrieve_
<< ", size: " << Bytes(length)
<< ", total: " << Bytes(bytesRetrieve_)
<< ", time: " << Seconds(elapsed)
Expand All @@ -108,7 +108,7 @@ void FDBStats::addFlush(eckit::Timer& timer) {
elapsedFlush_ += elapsed;
sumFlushTimingSquared_ += elapsed * elapsed;

Log::debug<LibFdb5>() << "Flush count: " << numFlush_
LOG_DEBUG_LIB(LibFdb5) << "Flush count: " << numFlush_
<< ", time: " << elapsed << "s"
<< ", total: " << elapsedFlush_ << "s" << std::endl;

Expand Down
20 changes: 10 additions & 10 deletions src/fdb5/api/LocalFDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace fdb5 {
void LocalFDB::archive(const Key& key, const void* data, size_t length) {

if (!archiver_) {
Log::debug<LibFdb5>() << *this << ": Constructing new archiver" << std::endl;
LOG_DEBUG_LIB(LibFdb5) << *this << ": Constructing new archiver" << std::endl;
archiver_.reset(new Archiver(config_));
}

Expand All @@ -58,7 +58,7 @@ void LocalFDB::archive(const Key& key, const void* data, size_t length) {
ListIterator LocalFDB::inspect(const metkit::mars::MarsRequest &request) {

if (!inspector_) {
Log::debug<LibFdb5>() << *this << ": Constructing new retriever" << std::endl;
LOG_DEBUG_LIB(LibFdb5) << *this << ": Constructing new retriever" << std::endl;
inspector_.reset(new Inspector(config_));
}

Expand All @@ -82,44 +82,44 @@ APIIterator<typename VisitorType::ValueType> LocalFDB::queryInternal(const FDBTo
}

ListIterator LocalFDB::list(const FDBToolRequest& request) {
Log::debug<LibFdb5>() << "LocalFDB::list() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "LocalFDB::list() : " << request << std::endl;
return queryInternal<ListVisitor>(request);
}

DumpIterator LocalFDB::dump(const FDBToolRequest &request, bool simple) {
Log::debug<LibFdb5>() << "LocalFDB::dump() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "LocalFDB::dump() : " << request << std::endl;
return queryInternal<DumpVisitor>(request, simple);
}

StatusIterator LocalFDB::status(const FDBToolRequest &request) {
Log::debug<LibFdb5>() << "LocalFDB::status() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "LocalFDB::status() : " << request << std::endl;
return queryInternal<StatusVisitor>(request);
}

WipeIterator LocalFDB::wipe(const FDBToolRequest &request, bool doit, bool porcelain, bool unsafeWipeAll) {
Log::debug<LibFdb5>() << "LocalFDB::wipe() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "LocalFDB::wipe() : " << request << std::endl;
return queryInternal<fdb5::api::local::WipeVisitor>(request, doit, porcelain, unsafeWipeAll);
}

MoveIterator LocalFDB::move(const FDBToolRequest& request, const eckit::URI& dest) {
Log::debug<LibFdb5>() << "LocalFDB::move() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "LocalFDB::move() : " << request << std::endl;
return queryInternal<fdb5::api::local::MoveVisitor>(request, dest);
}

PurgeIterator LocalFDB::purge(const FDBToolRequest& request, bool doit, bool porcelain) {
Log::debug<LibFdb5>() << "LocalFDB::purge() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "LocalFDB::purge() : " << request << std::endl;
return queryInternal<fdb5::api::local::PurgeVisitor>(request, doit, porcelain);
}

StatsIterator LocalFDB::stats(const FDBToolRequest& request) {
Log::debug<LibFdb5>() << "LocalFDB::stats() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "LocalFDB::stats() : " << request << std::endl;
return queryInternal<StatsVisitor>(request);
}

ControlIterator LocalFDB::control(const FDBToolRequest& request,
ControlAction action,
ControlIdentifiers identifiers) {
Log::debug<LibFdb5>() << "LocalFDB::control() : " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "LocalFDB::control() : " << request << std::endl;
return queryInternal<ControlVisitor>(request, action, identifiers);
}

Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/api/RandomFDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RandomFDBBuilder : public FDBBuilderBase {
std::random_device rd;
int choice = std::uniform_int_distribution<int>(0, fdbConfigs.size()-1)(rd);

Log::debug<LibFdb5>() << "Constructing random API instance: " << choice+1
LOG_DEBUG_LIB(LibFdb5) << "Constructing random API instance: " << choice+1
<< " / " << fdbConfigs.size() << std::endl;

ASSERT(choice >= 0);
Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/api/RemoteFDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ void RemoteFDB::connect() {
try {
// Connect to server, and check that the server is happy on the response

Log::debug<LibFdb5>() << "Connecting to host: " << controlEndpoint_ << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "Connecting to host: " << controlEndpoint_ << std::endl;
controlClient_.connect(controlEndpoint_, fdbMaxConnectRetries);
writeControlStartupMessage();
SessionID serverSession = verifyServerStartupResponse();

// Connect to the specified data port
Log::debug<LibFdb5>() << "Received data endpoint from host: " << dataEndpoint_ << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "Received data endpoint from host: " << dataEndpoint_ << std::endl;
dataClient_.connect(dataEndpoint_, fdbMaxConnectRetries);
writeDataStartupMessage(serverSession);

Expand Down
14 changes: 7 additions & 7 deletions src/fdb5/api/SelectFDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,47 +138,47 @@ auto SelectFDB::queryInternal(const FDBToolRequest& request, const QueryFN& fn)
}

ListIterator SelectFDB::list(const FDBToolRequest& request) {
Log::debug<LibFdb5>() << "SelectFDB::list() >> " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "SelectFDB::list() >> " << request << std::endl;
return queryInternal(request,
[](FDB& fdb, const FDBToolRequest& request) {
return fdb.list(request);
});
}

DumpIterator SelectFDB::dump(const FDBToolRequest& request, bool simple) {
Log::debug<LibFdb5>() << "SelectFDB::dump() >> " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "SelectFDB::dump() >> " << request << std::endl;
return queryInternal(request,
[simple](FDB& fdb, const FDBToolRequest& request) {
return fdb.dump(request, simple);
});
}

StatusIterator SelectFDB::status(const FDBToolRequest& request) {
Log::debug<LibFdb5>() << "SelectFDB::status() >> " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "SelectFDB::status() >> " << request << std::endl;
return queryInternal(request,
[](FDB& fdb, const FDBToolRequest& request) {
return fdb.status(request);
});
}

WipeIterator SelectFDB::wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) {
Log::debug<LibFdb5>() << "SelectFDB::wipe() >> " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "SelectFDB::wipe() >> " << request << std::endl;
return queryInternal(request,
[doit, porcelain, unsafeWipeAll](FDB& fdb, const FDBToolRequest& request) {
return fdb.wipe(request, doit, porcelain, unsafeWipeAll);
});
}

PurgeIterator SelectFDB::purge(const FDBToolRequest& request, bool doit, bool porcelain) {
Log::debug<LibFdb5>() << "SelectFDB::purge() >> " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "SelectFDB::purge() >> " << request << std::endl;
return queryInternal(request,
[doit, porcelain](FDB& fdb, const FDBToolRequest& request) {
return fdb.purge(request, doit, porcelain);
});
}

StatsIterator SelectFDB::stats(const FDBToolRequest &request) {
Log::debug<LibFdb5>() << "SelectFDB::stats() >> " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "SelectFDB::stats() >> " << request << std::endl;
return queryInternal(request,
[](FDB& fdb, const FDBToolRequest& request) {
return fdb.stats(request);
Expand All @@ -188,7 +188,7 @@ StatsIterator SelectFDB::stats(const FDBToolRequest &request) {
ControlIterator SelectFDB::control(const FDBToolRequest& request,
ControlAction action,
ControlIdentifiers identifiers) {
Log::debug<LibFdb5>() << "SelectFDB::control >> " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "SelectFDB::control >> " << request << std::endl;
return queryInternal(request,
[action, identifiers](FDB& fdb, const FDBToolRequest& request) {
return fdb.control(request, action, identifiers);
Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/api/helpers/FDBToolRequest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ std::vector<FDBToolRequest> FDBToolRequest::requestsFromString(const std::string
ASSERT(parsedRequests.size() == 1);

for (const auto& r : parsedRequests) {
eckit::Log::debug<LibFdb5>() << "Parsed request: " << static_cast<const metkit::mars::MarsRequest&>(r) << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "Parsed request: " << static_cast<const metkit::mars::MarsRequest&>(r) << std::endl;
checkMinimumKeys(r, minimumKeys);
}

Expand Down Expand Up @@ -75,7 +75,7 @@ std::vector<FDBToolRequest> FDBToolRequest::requestsFromString(const std::string
request.unsetValues(param);
}
}*/
eckit::Log::debug<LibFdb5>() << "Expanded request: " << request << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "Expanded request: " << request << std::endl;
requests.emplace_back(FDBToolRequest(request, false, minimumKeys));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/config/Config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Config::Config() : schemaPath_("") {
}

Config Config::make(const eckit::PathName& path, const eckit::Configuration& userConfig) {
eckit::Log::debug<LibFdb5>() << "Using FDB configuration file: " << path << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "Using FDB configuration file: " << path << std::endl;
Config cfg{YAMLConfiguration(path)};
cfg.set("configSource", path);
cfg.userConfig_ = std::make_shared<eckit::LocalConfiguration>(userConfig);
Expand Down Expand Up @@ -193,7 +193,7 @@ void Config::initializeSchemaPath() const {
schemaPath_ = expandPath(fdbSchemaFile);
}

eckit::Log::debug<LibFdb5>() << "Using FDB schema: " << schemaPath_ << std::endl;
LOG_DEBUG_LIB(LibFdb5) << "Using FDB schema: " << schemaPath_ << std::endl;
}

PathName Config::configPath() const {
Expand Down
Loading

0 comments on commit 549585a

Please sign in to comment.