1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

chore: add more debug logs (#4388)

This add more debug logs to help us trace how channels are being
filtered out
This commit is contained in:
Gastón Fournier 2023-08-02 13:03:51 +00:00 committed by GitHub
parent 187ed8a39a
commit 1017260c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,9 +70,7 @@ export default class SlackAppAddon extends Addon {
);
return;
}
this.logger.debug(
`Found candidate channels: ${JSON.stringify(eventChannels)}.`,
);
this.logger.debug(`Found candidate channels: ${eventChannels}.`);
if (!this.slackClient || this.accessToken !== accessToken) {
const client = new WebClient(accessToken);
@ -92,13 +90,17 @@ export default class SlackAppAddon extends Addon {
});
this.slackChannels = slackConversationsList.channels || [];
this.logger.debug(
`Fetched ${this.slackChannels.length} Slack channels`,
`Fetched ${
this.slackChannels.length
} available Slack channels: ${this.slackChannels.map(
({ name }) => name,
)}`,
);
}
const currentSlackChannels = [...this.slackChannels];
if (!currentSlackChannels.length) {
this.logger.warn('No Slack channels found.');
this.logger.warn('No available Slack channels found.');
return;
}
@ -109,6 +111,16 @@ export default class SlackAppAddon extends Addon {
({ id, name }) => id && name && eventChannels.includes(name),
);
if (!slackChannelsToPostTo.length) {
this.logger.info('No eligible Slack channel found.');
return;
}
this.logger.debug(
`Posting event to ${slackChannelsToPostTo.map(
({ name }) => name,
)}.`,
);
const requests = slackChannelsToPostTo.map(({ id }) =>
this.slackClient!.chat.postMessage({
channel: id!,