Improvements to logging

This commit is contained in:
Olivier Verhaegen 2023-06-09 11:01:10 +02:00 committed by GitHub
parent e129c676ec
commit 650168da00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -258,14 +258,13 @@ module.exports = function(RED) {
// Disconnection already in progress or not connected // Disconnection already in progress or not connected
callback(); callback();
} else { } else {
node.log("Unsubscribing from STOMP queue's...");
const subscribedQueues = Object.keys(node.subscriptionIds); const subscribedQueues = Object.keys(node.subscriptionIds);
subscribedQueues.forEach(function(queue) { subscribedQueues.forEach(function(queue) {
node.unsubscribe(queue); node.unsubscribe(queue);
}); });
node.log('Disconnecting from STOMP server...'); node.log('Disconnecting from STOMP server...');
waitDisconnect(node.client, 2000).then(() => { waitDisconnect(node.client, 2000).then(() => {
node.log("Disconnected from STOMP server", {sessionId: node.sessionId, url: `${node.options.address}:${node.options.port}`, protocolVersion: node.options.protocolVersion}) node.log(`Disconnected from STOMP server, sessionId: ${node.sessionId}, url: ${node.options.address}:${node.options.port}, protocolVersion: ${node.options.protocolVersion}`)
}).catch(() => { }).catch(() => {
node.log("Disconnect timeout closing node..."); node.log("Disconnect timeout closing node...");
}).finally(() => { }).finally(() => {
@ -323,7 +322,7 @@ module.exports = function(RED) {
delete node.subscriptionIds[queue]; delete node.subscriptionIds[queue];
if (node.connected && !node.closing) { if (node.connected && !node.closing) {
node.client.unsubscribe(queue, headers); node.client.unsubscribe(queue, headers);
node.log(`Unsubscribed from ${queue}`, headers); node.log(`Unsubscribed from ${queue}, headers: ${headers}`);
} }
} }