Skip to content

Commit feaaf30

Browse files
authored
Prevent serialization in LogProtobufMessage if log level is not met (#2077)
1 parent b4eda66 commit feaaf30

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

collector/lib/Utility.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ std::optional<std::string> SanitizedUTF8(std::string_view str) {
254254

255255
void LogProtobufMessage(const google::protobuf::Message& msg) {
256256
using namespace google::protobuf::util;
257+
258+
if (!logging::CheckLogLevel(logging::LogLevel::DEBUG)) {
259+
return;
260+
}
261+
257262
std::string output;
258263
absl::Status status = MessageToJsonString(msg, &output, JsonPrintOptions{});
259264
if (status.ok()) {

0 commit comments

Comments
 (0)