From 4753bfa037aa1b7e63db18487803ce795b51f166 Mon Sep 17 00:00:00 2001 From: Wu Shangwei <2826256824@qq.com> Date: Fri, 2 Jul 2021 17:15:32 +0800 Subject: [PATCH] LogBuffer Bugfix Signed-off-by: Wu Shangwei <2826256824@qq.com> --- services/hilogd/include/log_buffer.h | 2 +- services/hilogd/log_buffer.cpp | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/services/hilogd/include/log_buffer.h b/services/hilogd/include/log_buffer.h index 9318f67..7255074 100644 --- a/services/hilogd/include/log_buffer.h +++ b/services/hilogd/include/log_buffer.h @@ -59,7 +59,7 @@ private: uint64_t cacheLenByType[LOG_TYPE_MAX]; uint64_t droppedByType[LOG_TYPE_MAX]; uint64_t printLenByType[LOG_TYPE_MAX]; - bool conditionMatch(std::shared_ptr reader); + bool ConditionMatch(std::shared_ptr reader); void ReturnNoLog(std::shared_ptr reader); }; } // namespace HiviewDFX diff --git a/services/hilogd/log_buffer.cpp b/services/hilogd/log_buffer.cpp index fadacda..7b0180a 100644 --- a/services/hilogd/log_buffer.cpp +++ b/services/hilogd/log_buffer.cpp @@ -55,7 +55,6 @@ HilogBuffer::~HilogBuffer() {} size_t HilogBuffer::Insert(const HilogMsg& msg) { - printf("insert: %s\n", CONTENT_PTR((&msg))); size_t eleSize = CONTENT_LEN((&msg)); /* include '\0' */ if (unlikely(msg.tag_len > MAX_TAG_LEN || msg.tag_len == 0 || eleSize > MAX_LOG_LEN || eleSize <= 0)) { @@ -163,7 +162,7 @@ bool HilogBuffer::Query(std::shared_ptr reader) } while (reader->readPos != hilogDataList.end()) { reader->lastPos = reader->readPos; - if (conditionMatch(reader)) { + if (ConditionMatch(reader)) { reader->SetSendId(SENDIDA); reader->WriteData(&*(reader->readPos)); printLenByType[reader->readPos->type] += strlen(reader->readPos->content); @@ -330,7 +329,7 @@ int32_t HilogBuffer::ClearStatisticInfoByDomain(uint32_t domain) return 0; } -bool HilogBuffer::conditionMatch(std::shared_ptr reader) +bool HilogBuffer::ConditionMatch(std::shared_ptr reader) { /* domain patterns: * strict mode: 0xdxxxxxx (full) @@ -338,7 +337,7 @@ bool HilogBuffer::conditionMatch(std::shared_ptr reader) */ if (((static_cast((0b01 << (reader->readPos->type)) & (reader->queryCondition.types)) == 0) || - (static_cast((0b01 << (reader->readPos->level)) & (reader->queryCondition.types)) == 0))) + (static_cast((0b01 << (reader->readPos->level)) & (reader->queryCondition.levels)) == 0))) return false; int ret = 0; -- Gitee