Replacing cout with LOG (#3076)

* change cout to LOG

* lint fix
This commit is contained in:
Vadim Khotilovich 2018-02-06 02:00:34 -06:00 committed by GitHub
parent 7c99e90ecd
commit 94e655329f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 12 deletions

View File

@ -281,7 +281,7 @@ struct WQSummary {
// helper function to print the current content of sketch
inline void Print() const {
for (size_t i = 0; i < this->size; ++i) {
LOG(INFO) << "[" << i << "] rmin=" << data[i].rmin
LOG(CONSOLE) << "[" << i << "] rmin=" << data[i].rmin
<< ", rmax=" << data[i].rmax
<< ", wmin=" << data[i].wmin
<< ", v=" << data[i].value;
@ -321,7 +321,7 @@ struct WQSummary {
for (size_t i = 0; i < this->size; ++i) {
if (data[i].rmin + data[i].wmin > data[i].rmax + tol ||
data[i].rmin < -1e-6f || data[i].rmax < -1e-6f) {
LOG(INFO) << "----------check not pass----------";
LOG(INFO) << "---------- WQSummary::Check did not pass ----------";
this->Print();
return false;
}
@ -503,9 +503,8 @@ struct GKSummary {
/*! \brief used for debug purpose, print the summary */
inline void Print() const {
for (size_t i = 0; i < size; ++i) {
std::cout << "x=" << data[i].value << "\t"
<< "[" << data[i].rmin << "," << data[i].rmax << "]"
<< std::endl;
LOG(CONSOLE) << "x=" << data[i].value << "\t"
<< "[" << data[i].rmin << "," << data[i].rmax << "]";
}
}
/*!

View File

@ -27,7 +27,9 @@ struct Timer {
void Stop() { elapsed += ClockT::now() - start; }
double ElapsedSeconds() const { return SecondsT(elapsed).count(); }
void PrintElapsed(std::string label) {
printf("%s:\t %fs\n", label.c_str(), SecondsT(elapsed).count());
char buffer[255];
snprintf(buffer, sizeof(buffer), "%s:\t %fs", label.c_str(), SecondsT(elapsed).count());
LOG(CONSOLE) << buffer;
Reset();
}
};
@ -50,9 +52,7 @@ struct Monitor {
~Monitor() {
if (!debug_verbose) return;
std::cout << "========\n";
std::cout << "Monitor: " << label << "\n";
std::cout << "========\n";
LOG(CONSOLE) << "======== Monitor: " << label << " ========";
for (auto &kv : timer_map) {
kv.second.PrintElapsed(kv.first);
}