Skip to content

Commit

Permalink
Avoid logging messages when anonymization is on
Browse files Browse the repository at this point in the history
Signed-off-by: Cosmin Humeniuc <[email protected]>
Change-Id: I5bcf615521d13758b2b70a0c9466a3bbc1a0a918
  • Loading branch information
cosminh11 authored and caolanm committed Oct 18, 2023
1 parent 53d84b4 commit 7dae294
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
12 changes: 11 additions & 1 deletion kit/Kit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,17 @@ class Document final : public DocumentManagerInterface
}
}

const std::string abbrMessage = getAbbreviatedMessage(data, size);
std::string abbrMessage;
#ifndef BUILDING_TESTS
if (AnonymizeUserData)
{
abbrMessage = "...";
}
else
#endif
{
abbrMessage = getAbbreviatedMessage(data, size);
}
LOG_ERR("Child session [" << sessionId << "] not found to forward message: " << abbrMessage);
}
else
Expand Down
6 changes: 4 additions & 2 deletions wsd/COOLWSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3858,13 +3858,15 @@ class PrisonerRequestDispatcher final : public WebSocketHandler
}
else if (child && child->getPid() > 0)
{
const std::string abbreviatedMessage = COOLWSD::AnonymizeUserData ? "..." : message->abbr();
LOG_WRN("Child " << child->getPid() << " has no DocBroker to handle message: ["
<< message->abbr() << ']');
<< abbreviatedMessage << ']');
}
else
{
const std::string abbreviatedMessage = COOLWSD::AnonymizeUserData ? "..." : message->abbr();
LOG_ERR("Cannot handle message with unassociated Kit (PID " << _pid << "): ["
<< message->abbr());
<< abbreviatedMessage);
}
}

Expand Down
3 changes: 2 additions & 1 deletion wsd/DocumentBroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3659,7 +3659,8 @@ bool DocumentBroker::forwardToClient(const std::shared_ptr<Message>& payload)
}
else
{
LOG_WRN("Client session [" << sid << "] not found to forward message: " << payload->abbr());
const std::string abbreviatedPayload = COOLWSD::AnonymizeUserData ? "..." : payload->abbr();
LOG_WRN("Client session [" << sid << "] not found to forward message: " << abbreviatedPayload);
}
}
}
Expand Down

0 comments on commit 7dae294

Please sign in to comment.