Improve logging around message sending.

There were some message types where we didn't log the timestamp.
The timestamp is important for debugging issues (let's us locate an
error more precisely in the logs).
This commit is contained in:
Greyson Parrelli
2023-03-23 18:08:39 -04:00
parent d58c4ef439
commit 76984ab042
2 changed files with 22 additions and 2 deletions
@@ -181,9 +181,9 @@ public class LogSectionSystemInfo implements LogSection {
if (aci != null) {
String aciString = aci.toString();
String lastTwo = aciString.substring(aciString.length() - 2);
String lastThree = aciString.substring(aciString.length() - 3);
return "********-****-****-****-**********" + lastTwo;
return "********-****-****-****-*********" + lastThree;
} else {
return "N/A";
}
@@ -212,6 +212,8 @@ public class SignalServiceMessageSender {
boolean includePniSignature)
throws IOException, UntrustedIdentityException
{
Log.d(TAG, "[" + message.getWhen() + "] Sending a receipt.");
Content content = createReceiptContent(message);
if (includePniSignature) {
@@ -235,6 +237,8 @@ public class SignalServiceMessageSender {
throws IOException, UntrustedIdentityException
{
Log.d(TAG, "[" + errorMessage.getTimestamp() + "] Sending a retry receipt.");
PlaintextContent content = new PlaintextContent(errorMessage);
EnvelopeContent envelopeContent = EnvelopeContent.plaintext(content, groupId);
@@ -250,6 +254,8 @@ public class SignalServiceMessageSender {
CancelationSignal cancelationSignal)
throws IOException
{
Log.d(TAG, "[" + message.getTimestamp() + "] Sending a typing message to " + recipients.size() + " recipient(s) using 1:1 messages.");
Content content = createTypingContent(message);
EnvelopeContent envelopeContent = EnvelopeContent.encrypted(content, ContentHint.IMPLICIT, Optional.empty());
@@ -265,6 +271,8 @@ public class SignalServiceMessageSender {
SignalServiceTypingMessage message)
throws IOException, UntrustedIdentityException, InvalidKeyException, NoSessionException, InvalidRegistrationIdException
{
Log.d(TAG, "[" + message.getTimestamp() + "] Sending a typing message to " + recipients.size() + " recipient(s) using sender key.");
Content content = createTypingContent(message);
sendGroupMessage(distributionId, recipients, unidentifiedAccess, message.getTimestamp(), content, ContentHint.IMPLICIT, message.getGroupId(), true, SenderKeyGroupEvents.EMPTY, false, false);
}
@@ -279,6 +287,8 @@ public class SignalServiceMessageSender {
Set<SignalServiceStoryMessageRecipient> manifest)
throws IOException, UntrustedIdentityException
{
Log.d(TAG, "[" + timestamp + "] Sending a story sync message.");
if (manifest.isEmpty() && !message.getGroupContext().isPresent()) {
Log.w(TAG, "Refusing to send sync message for empty manifest in non-group story.");
return;
@@ -302,6 +312,8 @@ public class SignalServiceMessageSender {
Set<SignalServiceStoryMessageRecipient> manifest)
throws IOException, UntrustedIdentityException, InvalidKeyException, NoSessionException, InvalidRegistrationIdException
{
Log.d(TAG, "[" + timestamp + "] Sending a story.");
Content content = createStoryContent(message);
List<SendMessageResult> sendMessageResults = sendGroupMessage(distributionId, recipients, unidentifiedAccess, timestamp, content, ContentHint.IMPLICIT, groupId, false, SenderKeyGroupEvents.EMPTY, false, true);
@@ -325,6 +337,8 @@ public class SignalServiceMessageSender {
SignalServiceCallMessage message)
throws IOException, UntrustedIdentityException
{
Log.d(TAG, "[" + message.getTimestamp() + "] Sending a call message (single recipient).");
Content content = createCallContent(message);
EnvelopeContent envelopeContent = EnvelopeContent.encrypted(content, ContentHint.DEFAULT, Optional.empty());
@@ -336,6 +350,8 @@ public class SignalServiceMessageSender {
SignalServiceCallMessage message)
throws IOException
{
Log.d(TAG, "[" + message.getTimestamp() + "] Sending a call message (multiple recipients).");
Content content = createCallContent(message);
EnvelopeContent envelopeContent = EnvelopeContent.encrypted(content, ContentHint.DEFAULT, Optional.empty());
@@ -348,6 +364,8 @@ public class SignalServiceMessageSender {
SignalServiceCallMessage message)
throws IOException, UntrustedIdentityException, InvalidKeyException, NoSessionException, InvalidRegistrationIdException
{
Log.d(TAG, "[" + message.getTimestamp() + "] Sending a call message (sender key).");
Content content = createCallContent(message);
return sendGroupMessage(distributionId, recipients, unidentifiedAccess, message.getTimestamp().get(), content, ContentHint.IMPLICIT, message.getGroupId(), false, SenderKeyGroupEvents.EMPTY, message.isUrgent(), false);
}
@@ -464,6 +482,8 @@ public class SignalServiceMessageSender {
boolean urgent)
throws UntrustedIdentityException, IOException
{
Log.d(TAG, "[" + timestamp + "] Resending content.");
EnvelopeContent envelopeContent = EnvelopeContent.encrypted(content, contentHint, groupId);
Optional<UnidentifiedAccess> access = unidentifiedAccess.isPresent() ? unidentifiedAccess.get().getTargetUnidentifiedAccess() : Optional.empty();