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:
parent
187ed8a39a
commit
1017260c00
@ -70,9 +70,7 @@ export default class SlackAppAddon extends Addon {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.logger.debug(
|
this.logger.debug(`Found candidate channels: ${eventChannels}.`);
|
||||||
`Found candidate channels: ${JSON.stringify(eventChannels)}.`,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!this.slackClient || this.accessToken !== accessToken) {
|
if (!this.slackClient || this.accessToken !== accessToken) {
|
||||||
const client = new WebClient(accessToken);
|
const client = new WebClient(accessToken);
|
||||||
@ -92,13 +90,17 @@ export default class SlackAppAddon extends Addon {
|
|||||||
});
|
});
|
||||||
this.slackChannels = slackConversationsList.channels || [];
|
this.slackChannels = slackConversationsList.channels || [];
|
||||||
this.logger.debug(
|
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];
|
const currentSlackChannels = [...this.slackChannels];
|
||||||
if (!currentSlackChannels.length) {
|
if (!currentSlackChannels.length) {
|
||||||
this.logger.warn('No Slack channels found.');
|
this.logger.warn('No available Slack channels found.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +111,16 @@ export default class SlackAppAddon extends Addon {
|
|||||||
({ id, name }) => id && name && eventChannels.includes(name),
|
({ 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 }) =>
|
const requests = slackChannelsToPostTo.map(({ id }) =>
|
||||||
this.slackClient!.chat.postMessage({
|
this.slackClient!.chat.postMessage({
|
||||||
channel: id!,
|
channel: id!,
|
||||||
|
Loading…
Reference in New Issue
Block a user