Use structured logs

Easier to search for static prefix and fields are named.
pull/1/head
Daniel Gasienica 7 years ago
parent 0ce56eed87
commit 13f1ec2e51

@ -6,7 +6,9 @@
// Load messages that have expired and destroy them // Load messages that have expired and destroy them
var expired = new Whisper.MessageCollection(); var expired = new Whisper.MessageCollection();
expired.on('add', function(message) { 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(); var conversation = message.getConversation();
if (conversation) { if (conversation) {
conversation.trigger('expired', message); conversation.trigger('expired', message);

@ -845,7 +845,10 @@
} }
Whisper.ExpiringMessagesListener.update(); 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() { fetchExpired() {
console.log('loading expired messages'); console.log('Load expired messages');
this.fetch({ this.fetch({
conditions: { expires_at: { $lte: Date.now() } }, conditions: { expires_at: { $lte: Date.now() } },
addIndividually: true, addIndividually: true,

@ -815,11 +815,9 @@
}, },
async onExpiredCollection(message) { async onExpiredCollection(message) {
const removeMessage = () => { const removeMessage = () => {
console.log( console.log('Remove expired message from message collection', {
'removing message', sentAt: message.get('sent_at'),
message.get('sent_at'), });
'from collection'
);
this.model.messageCollection.remove(message.id); this.model.messageCollection.remove(message.id);
}; };

Loading…
Cancel
Save