Skip to content

Commit

Permalink
Use macro for debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisspyB committed Feb 21, 2024
1 parent d11b0a6 commit 59bb67d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 24 deletions.
18 changes: 9 additions & 9 deletions src/metkit/mars/DHSProtocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ Length DHSProtocol::retrieve(const MarsRequest& request)
{
Endpoint callbackEndpoint = callback_->endpoint();

Log::debug() << "DHSProtocol: call back on " << callbackEndpoint << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "DHSProtocol: call back on " << callbackEndpoint << std::endl;

task_.reset(new ClientTask(request, RequestEnvironment::instance().request(),
callbackEndpoint.host(), callbackEndpoint.port()));
Expand All @@ -385,16 +385,16 @@ Length DHSProtocol::retrieve(const MarsRequest& request)
while (wait(result)) {
}

Log::debug() << "DHSProtocol::retrieve " << result << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "DHSProtocol::retrieve " << result << std::endl;
return result;
}

void DHSProtocol::archive(const MarsRequest& request, const Length& size)
{
Endpoint callbackEndpoint = callback_->endpoint();

Log::debug() << "DHSProtocol::archive " << size << std::endl;
Log::debug() << "DHSProtocol: call back on " << callbackEndpoint << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "DHSProtocol::archive " << size << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "DHSProtocol: call back on " << callbackEndpoint << std::endl;

task_.reset(new ClientTask(request, RequestEnvironment::instance().request(),
callbackEndpoint.host(), callbackEndpoint.port()));
Expand All @@ -408,7 +408,7 @@ void DHSProtocol::archive(const MarsRequest& request, const Length& size)
Length result = size;
while (wait(result)) {
}
Log::debug() << "DHSProtocol: archive completed." << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "DHSProtocol: archive completed." << std::endl;
}

void DHSProtocol::cleanup()
Expand Down Expand Up @@ -488,7 +488,7 @@ bool DHSProtocol::wait(Length& size)

char code = task_->receive(s);

Log::debug() << "DHSProtocol: code [" << code << "]" << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "DHSProtocol: code [" << code << "]" << std::endl;

std::string msg;
long long bytes;
Expand All @@ -502,7 +502,7 @@ bool DHSProtocol::wait(Length& size)
/* read source */
case 'r':
bytes = size;
Log::debug() << "DHSProtocol:r [" << bytes << "]" << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "DHSProtocol:r [" << bytes << "]" << std::endl;
s << bytes;
sending_ = true;
return false;
Expand All @@ -514,7 +514,7 @@ bool DHSProtocol::wait(Length& size)

case 'w':
s >> bytes;
Log::debug() << "DHSProtocol:w " << bytes << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "DHSProtocol:w " << bytes << std::endl;
size = bytes;
return false;

Expand Down Expand Up @@ -555,7 +555,7 @@ bool DHSProtocol::wait(Length& size)

case 'D': /* debug */
s >> msg;
Log::debug() << msg << " [" << name_ << "]" << std::endl;
LOG_DEBUG_LIB(LibMetkit) << msg << " [" << name_ << "]" << std::endl;
if (forward_) {
Log::userInfo() << msg << " [" << name_ << "]" << std::endl;
}
Expand Down
4 changes: 3 additions & 1 deletion src/metkit/mars/MarsRequestHandle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// Baudouin Raoult - (c) ECMWF Feb 12

#include "metkit/mars/MarsRequestHandle.h"
#include "metkit/config/LibMetkit.h"

#include "eckit/utils/StringTools.h"
#include "eckit/types/Types.h"

Expand Down Expand Up @@ -53,7 +55,7 @@ MarsRequestHandle::MarsRequestHandle(const MarsRequest& request,
protocol_(protocol),
opened_(false)
{
eckit::Log::debug() << "MarsRequestHandle::MarsRequestHandle: request: " << request << " protocol: " << protocol << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "MarsRequestHandle::MarsRequestHandle: request: " << request << " protocol: " << protocol << std::endl;
ASSERT(protocol);
}

Expand Down
4 changes: 2 additions & 2 deletions src/metkit/mars/ParamID.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void ParamID::normalise(const REQUEST_T& request,
newreq.push_back(p);
}

eckit::Log::debug<LibMetkit>() << "useGRIBParamID p=" << p
LOG_DEBUG_LIB(LibMetkit) << "useGRIBParamID p=" << p
<< ", alt=" << alt
<< ", choice=" << newreq.back() << std::endl;

Expand Down Expand Up @@ -174,7 +174,7 @@ void ParamID::normalise(const REQUEST_T& request,
if (!wantVO) req.push_back(windVO);
if (!wantD) req.push_back(windD);

eckit::Log::debug<LibMetkit>() << "U/V conversion requested U=" << windU << ", V=" << windV << ", VO=" << windVO << ", D=" << windD << std::endl;
LOG_DEBUG_LIB(LibMetkit)<< "U/V conversion requested U=" << windU << ", V=" << windV << ", VO=" << windVO << ", D=" << windD << std::endl;
windConversion = true;
}
}
Expand Down
13 changes: 3 additions & 10 deletions src/metkit/mars/TypeParam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,7 @@ Rule::Rule(const eckit::Value& matchers, const eckit::Value& values, const eckit

if (aliases.isNil()) {

Log::debug<LibMetkit>()
<< "No aliases for "
<< id
<< " "
<< *this
<< std::endl;
LOG_DEBUG_LIB(LibMetkit) << "No aliases for " << id << " " << *this << std::endl;
continue;
}

Expand All @@ -158,8 +153,7 @@ Rule::Rule(const eckit::Value& matchers, const eckit::Value& values, const eckit

if (precedence[v] <= j) {

Log::debug<LibMetkit>()
<< "Redefinition ignored: param "
LOG_DEBUG_LIB(LibMetkit) << "Redefinition ignored: param "
<< v
<< "='"
<< first
Expand All @@ -172,8 +166,7 @@ Rule::Rule(const eckit::Value& matchers, const eckit::Value& values, const eckit
}
else {

Log::debug<LibMetkit>()
<< "Redefinition of param "
LOG_DEBUG_LIB(LibMetkit) << "Redefinition of param "
<< v
<< "='"
<< first
Expand Down
4 changes: 2 additions & 2 deletions src/metkit/odb/IdMapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ IdMap::IdMap(const std::string& configFile,
size_t alphanumericIndex) {

PathName configPath = codes_path() / configFile;
Log::debug<LibMetkit>() << "GribCodesBase::GribCodesBase: config file:" << configPath << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "GribCodesBase::GribCodesBase: config file:" << configPath << std::endl;

numeric2alpha_.clear();

Expand All @@ -99,7 +99,7 @@ IdMap::IdMap(const std::string& configFile,
long num = eckit::Translator<std::string, long>()(StringTools::trim(words[numericIndex]));
std::string alpha (StringTools::trim(words[alphanumericIndex]));
numeric2alpha_[num] = StringTools::lower(alpha);
Log::debug<LibMetkit>() << "GribCodesBase::readConfig: num='" << num << "' alpha='" << alpha << "'" << std::endl;
LOG_DEBUG_LIB(LibMetkit) << "GribCodesBase::readConfig: num='" << num << "' alpha='" << alpha << "'" << std::endl;
}
}
}
Expand Down

0 comments on commit 59bb67d

Please sign in to comment.