chore_: better community json log (#5118)

This commit is contained in:
Igor Sirotin 2024-05-08 15:49:41 +01:00 committed by GitHub
parent 2d6ddf733d
commit 1c43b7a29b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 11 deletions

View File

@ -6,7 +6,6 @@ import (
"crypto/ecdsa" "crypto/ecdsa"
"database/sql" "database/sql"
"encoding/hex" "encoding/hex"
"encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net" "net"
@ -5428,12 +5427,11 @@ func (m *Manager) encryptCommunityDescriptionImpl(groupID []byte, d *protobuf.Co
return "", nil, err return "", nil, err
} }
communityJSON, err := json.Marshal(d) m.logger.Debug("encrypting community description",
if err != nil { zap.Any("community", d),
return "", nil, err zap.String("groupID", types.Bytes2Hex(groupID)),
} zap.String("keyID", types.Bytes2Hex(keyID)))
m.logger.Debug("encrypting community description", zap.String("community", string(communityJSON)), zap.String("groupID", types.Bytes2Hex(groupID)), zap.String("key-id", types.Bytes2Hex(keyID)))
keyIDSeqNo := fmt.Sprintf("%s%d", hex.EncodeToString(keyID), newSeqNo) keyIDSeqNo := fmt.Sprintf("%s%d", hex.EncodeToString(keyID), newSeqNo)
return keyIDSeqNo, encryptedPayload, nil return keyIDSeqNo, encryptedPayload, nil

View File

@ -109,11 +109,12 @@ func (m *Messenger) publishOrg(org *communities.Community, shouldRekey bool) err
return nil return nil
} }
communityJSON, err := json.Marshal(org) m.logger.Debug("publishing community",
if err != nil { zap.Uint64("clock", org.Clock()),
return err zap.String("communityID", org.IDString()),
} zap.Any("community", org),
m.logger.Debug("publishing org", zap.String("org-id", org.IDString()), zap.Uint64("clock", org.Clock()), zap.String("org", string(communityJSON))) )
payload, err := org.MarshaledDescription() payload, err := org.MarshaledDescription()
if err != nil { if err != nil {