From c2cc00574415c612e82f0955523d422f59594912 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期四, 06 五月 2021 19:40:38 +0800
Subject: [PATCH] disable center console log.
---
box/center.cpp | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/box/center.cpp b/box/center.cpp
index aa6f285..c57d34d 100644
--- a/box/center.cpp
+++ b/box/center.cpp
@@ -18,6 +18,7 @@
#include "center.h"
#include "bh_util.h"
#include "defs.h"
+#include "log.h"
#include "shm.h"
#include <chrono>
#include <set>
@@ -60,9 +61,7 @@
void UpdateState(const int64_t now, const int64_t offline_time, const int64_t kill_time)
{
auto diff = now - timestamp_;
-#ifndef NDEBUG
- printf("state %p diff: %ld\n", this, diff);
-#endif
+ LOG_DEBUG() << "state " << this << " diff: " << diff;
if (diff < offline_time) {
flag_ = kStateNormal;
} else if (diff < kill_time) {
@@ -117,7 +116,7 @@
Node node(new NodeInfo);
UpdateRegInfo(node);
nodes_[ssn] = node;
- printf("new node ssn (%ld) init\n", ssn);
+ LOG_INFO() << "new node ssn (" << ssn << ") init";
}
MsgCommonReply Register(const BHMsgHead &head, MsgRegister &msg)
{
@@ -148,14 +147,14 @@
UpdateRegInfo(node);
nodes_[ssn] = node;
}
- printf("node (%s) ssn (%ld)\n", head.proc_id().c_str(), ssn);
+ LOG_DEBUG() << "node (" << head.proc_id() << ") ssn (" << ssn << ")";
auto old = online_node_addr_map_.find(head.proc_id());
if (old != online_node_addr_map_.end()) { // old session
auto &old_ssn = old->second;
if (old_ssn != ssn) {
nodes_[old_ssn]->state_.PutOffline(offline_time_);
- printf("put node (%s) ssn (%ld) offline\n", nodes_[old_ssn]->proc_.proc_id().c_str(), old->second);
+ LOG_DEBUG() << "put node (" << nodes_[old_ssn]->proc_.proc_id() << ") ssn (" << old->second << ") offline";
old_ssn = ssn;
}
} else {
@@ -218,9 +217,9 @@
for (auto &topic : topics) {
service_map_[topic].insert(dest);
}
- printf("node %s ssn %ld serve %d topics:\n", node->proc_.proc_id().c_str(), *node->addrs_.begin(), topics.size());
+ LOG_DEBUG() << "node " << node->proc_.proc_id() << " ssn " << *node->addrs_.begin() << " serve " << topics.size() << " topics:\n";
for (auto &topic : topics) {
- printf("\t %s\n", topic.c_str());
+ LOG_DEBUG() << "\t" << topic;
}
return MakeReply(eSuccess);
});
@@ -572,7 +571,7 @@
auto gc = [&](const MQId id) {
auto r = ShmSocket::Remove(shm, id);
if (r) {
- printf("remove mq %ld ok\n", id);
+ LOG_DEBUG() << "remove mq " << id << " ok\n";
}
};
--
Gitblit v1.8.0