Skip to content

Commit

Permalink
2.3.6 update. Just dependencies and readme changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAppleFreak committed Nov 12, 2024
1 parent 4976a4e commit 879b4d1
Show file tree
Hide file tree
Showing 4 changed files with 816 additions and 829 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

(all dates use the ISO-8601 format, which is YYYY/MM/DD)

## 2.3.6 (2024/11/12)

* No changes have been made to the code in this release.
* Updated dependencies so Dependabot would stop yelling at me.
* Fixed link rot in README.md and slightly updated one of the code examples so it reads better.

## 2.3.5 (2024/3/21)

* No changes have been made to the code in this release.
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ logger.add(new SlackHook({ webhookUrl: "https://hooks.slack.com/services/xxx/xxx
### Options

* `webhookUrl` **REQUIRED** - Slack incoming webhook URL. [Follow steps 1 through 3 at this link to create a new webhook if you don't already have one](https://api.slack.com/messaging/webhooks).
* `formatter` - Custom function to format messages with. This function accepts the `info` object ([see Winston documentation](https://github.com/winstonjs/winston/blob/master/README.md#streams-objectmode-and-info-objects)) and must return an object with at least one of the following three keys: `text` (string), `attachments` (array of [attachment objects](https://api.slack.com/messaging/composing/layouts#attachments)), `blocks` (array of [layout block objects](https://api.slack.com/messaging/composing/layouts#adding-blocks)). These will be used to structure the format of the logged Slack message. By default, messages will use the format of `[level]: [message]` with no attachments or layout blocks. A value of `false` can also be returned to prevent a message from being sent to Slack.
* `formatter` - Custom function to format messages with. This function accepts the `info` object ([see Winston documentation](https://github.com/winstonjs/winston/blob/master/README.md#streams-objectmode-and-info-objects)) and must return an object with at least one of the following three keys: `text` (string), `attachments` (array of [attachment objects](https://api.slack.com/reference/surfaces/formatting#attachments)), `blocks` (array of [layout block objects](https://api.slack.com/reference/surfaces/formatting#rich-layouts)). These will be used to structure the format of the logged Slack message. By default, messages will use the format of `[level]: [message]` with no attachments or layout blocks. A value of `false` can also be returned to prevent a message from being sent to Slack.
* `level` - Level to log. Global settings will apply if left undefined.
* `unfurlLinks` - Enables or disables [link unfurling.](https://api.slack.com/reference/messaging/link-unfurling#no_unfurling_please) (Default: `false`)
* `unfurlMedia` - Enables or disables [media unfurling.](https://api.slack.com/reference/messaging/link-unfurling#no_unfurling_please) (Default: `false`)
* `mrkdwn` - Enables or disables [`mrkdwn` formatting](https://api.slack.com/reference/surfaces/formatting#basics) within attachments or layout blocks (Default: `false`)
* `unfurlLinks` - Enables or disables [link unfurling.](https://api.slack.com/reference/messaging/link-unfurling) (Default: `false`)
* `unfurlMedia` - Enables or disables [media unfurling.](https://api.slack.com/reference/messaging/link-unfurling) (Default: `false`)
* `mrkdwn` - Enables or disables [`mrkdwn` formatting](https://api.slack.com/reference/surfaces/formatting) within attachments or layout blocks (Default: `false`)
* `proxy` - Allows specifying a proxy server that [gets passed directly down to Axios](https://github.com/axios/axios#request-config) (Default: `undefined`)
* `channel` - Overrides the webhook's default channel. This should be a channel ID. (Default: `undefined`)
* `username` - Overrides the webhook's default username. (Default: `undefined`)
Expand All @@ -58,7 +58,7 @@ logger.add(new SlackHook({ webhookUrl: "https://hooks.slack.com/services/xxx/xxx

### Message formatting

`winston-slack-webhook-transport` supports the ability to format messages using Slack's message layout features. To do this, supply a custom formatter function that returns the [requisite object structure](https://api.slack.com/messaging/composing/layouts) to create the desired layout. You can use the [Slack Block Kit Builder](https://app.slack.com/block-kit-builder/) to quickly and easily prototype advanced layouts using Block Kit.
`winston-slack-webhook-transport` supports the ability to format messages using Slack's message layout features. To do this, supply a custom formatter function that returns the [requisite object structure](https://api.slack.com/reference/surfaces/formatting#rich-layouts) to create the desired layout. You can use the [Slack Block Kit Builder](https://api.slack.com/tools/block-kit-builder) to quickly and easily prototype advanced layouts using Block Kit.

If for some reason you don't want to send a message to Slack, you can also return `false` to prevent the log message from being sent.

Expand All @@ -78,11 +78,6 @@ const logger = winston.createLogger({
formatter: info => {
return {
text: "This will function as a fallback for surfaces that don't support Block Kit, like IRC clients or mobile push notifications.",
attachments: [
{
text: "Or don't pass anything. That's fine too"
}
],
blocks: [
{
type: "section",
Expand All @@ -91,6 +86,11 @@ const logger = winston.createLogger({
text: "You can pass more info to the formatter by supplying additional parameters in the logger call"
}
}
],
attachments: [
{
text: "Or don't pass anything. That's fine too"
}
]
}
}
Expand Down
Loading

0 comments on commit 879b4d1

Please sign in to comment.