Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jitesoft/yolog-slack-plugin
Slack plugin for @jitesoft/yolog.
https://github.com/jitesoft/yolog-slack-plugin
hacktoberfest jitesoft slack slack-webhooks yolog yolog-plugin
Last synced: about 2 months ago
JSON representation
Slack plugin for @jitesoft/yolog.
- Host: GitHub
- URL: https://github.com/jitesoft/yolog-slack-plugin
- Owner: jitesoft
- License: mit
- Created: 2019-11-03T15:59:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-05T22:04:50.000Z (11 months ago)
- Last Synced: 2024-11-09T12:14:57.692Z (3 months ago)
- Topics: hacktoberfest, jitesoft, slack, slack-webhooks, yolog, yolog-plugin
- Language: JavaScript
- Homepage:
- Size: 1.67 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yolog Slack plugin
[](https://www.npmjs.com/package/@jitesoft/yolog-slack-plugin)
[](https://dev.snyk.io/test/npm/@jitesoft/yolog-slack-plugin)
[](https://gitlab.com/jitesoft/open-source/javascript/yolog-plugins/slack/commits/master)
[](https://gitlab.com/jitesoft/open-source/javascript/yolog-plugins/slack/commits/master)
[](https://www.npmjs.com/package/@jitesoft/yolog-slack-plugin)
[](https://opencollective.com/jitesoft-open-source)Plugin for the [`@jitesoft/yolog`](https://www.npmjs.com/package/@jitesoft/yolog) logger to post logs to Slack.
This plugin makes use of the slack WebHooks, hence it is only supported on the server side and not browser.

## Usage:
Install with your favorite package manager!
```bash
npm i @jitesoft/yolog-slack-plugin --save
yarn add @jitesoft/yolog-slack-plugin
```Import and use just as with any other yolog plugin!
```js
import logger from '@jitesoft/yolog';
import SlackPlugin from '@jitesoft/yolog-slack-plugin';
logger.addPlugin(new SlackPlugin('https://webhook/uri'));
```The constructor of the slack plugin takes a slack webhook uri, (please check the slack documentation on how to acquire
one of those) and an optional channel with the `#` prefix (or user with the `@` prefix). If the channel argument is not
set, it will use the default channel set up with the webhook.### Notification
The notification text can be changed with the `notificationText` setter. It defaults to `A log message with the tag '%s' was logged!` where `%s` will be changed the tag name.
You may also add another `%s` (check the [`@jitesoft/sprintf`](https://www.npmjs.com/package/@jitesoft/sprintf) module for more info about the placeholders) which will be changed to the log message.### Call stack
In case the message is one of the 'higher level' logging types (error, critical, alert or emergency), the call stack (from the yolog #log method as of now) will be printed as an extra section in the message.