Use structured logs
Easier to search for static prefix and fields are named.
This commit is contained in:
parent
0ce56eed87
commit
13f1ec2e51
3 changed files with 11 additions and 8 deletions
|
@ -6,7 +6,9 @@
|
|||
// Load messages that have expired and destroy them
|
||||
var expired = new Whisper.MessageCollection();
|
||||
expired.on('add', function(message) {
|
||||
console.log('message', message.get('sent_at'), 'expired');
|
||||
console.log('Message expired', {
|
||||
sentAt: message.get('sent_at'),
|
||||
});
|
||||
var conversation = message.getConversation();
|
||||
if (conversation) {
|
||||
conversation.trigger('expired', message);
|
||||
|
|
|
@ -845,7 +845,10 @@
|
|||
}
|
||||
|
||||
Whisper.ExpiringMessagesListener.update();
|
||||
console.log('message', this.get('sent_at'), 'expires at', expiresAt);
|
||||
console.log('Set message expiration', {
|
||||
expiresAt,
|
||||
sentAt: this.get('sent_at'),
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -959,7 +962,7 @@
|
|||
},
|
||||
|
||||
fetchExpired() {
|
||||
console.log('loading expired messages');
|
||||
console.log('Load expired messages');
|
||||
this.fetch({
|
||||
conditions: { expires_at: { $lte: Date.now() } },
|
||||
addIndividually: true,
|
||||
|
|
|
@ -815,11 +815,9 @@
|
|||
},
|
||||
async onExpiredCollection(message) {
|
||||
const removeMessage = () => {
|
||||
console.log(
|
||||
'removing message',
|
||||
message.get('sent_at'),
|
||||
'from collection'
|
||||
);
|
||||
console.log('Remove expired message from message collection', {
|
||||
sentAt: message.get('sent_at'),
|
||||
});
|
||||
this.model.messageCollection.remove(message.id);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue