winston-discord
v0.2.0
Published
A Discord transport for winston using webhooks
Downloads
4
Maintainers
Readme
winston-discord
A Discord transport for Winston using webhooks
Usage
The example webhooks were generated by discord but have since been deleted. If you post to these webhooks you will get a "10015: Unknown Webhook" error.
const winston = require('winston');
// Default winston options +
// the following options are supported
const options = {
// A single webhook URL
webhooks: 'https://discordapp.com/api/webhooks/446240708299587584/W_y7cmhCv2KY-oKopLHFTTw08L0apQVS0bkrUDHV44Es4Vb-p3Z4uEEHEwpVkHVjpaqg'
// Multiple webhooks by URL
webhooks: [
'https://discordapp.com/api/webhooks/446240708299587584/W_y7cmhCv2KY-oKopLHFTTw08L0apQVS0bkrUDHV44Es4Vb-p3Z4uEEHEwpVkHVjpaqg',
'https://discordapp.com/api/webhooks/446241166493483008/JeOKubEIRAcalZISmjGrG6DuzHX_KdE5Uzq_r0mK0318voc_7TRjC6NA_oe-fYX_eAhn'
],
// Single webhook by id and token
webhooks: {
id: '446241166493483008',
token: 'JeOKubEIRAcalZISmjGrG6DuzHX_KdE5Uzq_r0mK0318voc_7TRjC6NA_oe-fYX_eAhn'
},
// Multiple webhooks by id and token
webhooks: [
{id: '446240708299587584', token: 'W_y7cmhCv2KY-oKopLHFTTw08L0apQVS0bkrUDHV44Es4Vb-p3Z4uEEHEwpVkHVjpaqg'},
{id: '446241166493483008', token: 'JeOKubEIRAcalZISmjGrG6DuzHX_KdE5Uzq_r0mK0318voc_7TRjC6NA_oe-fYX_eAhn'}
],
// Colors (optional Default: true)
colors: false, // Will only work in Discord in dark mode
// Change a level's color
colors: { 'warn': 0xF58A07 },
// Inline (optional Default: true)
inline: false,
// Set per meta
inline: { anythingMeta: false }
};
const logger = new (winston.Logger)({
transports: [
new (DiscordLogger)(options)
]
});
logger.log('info', 'Hi discord!');
Planned functionality
- Metadata
- Log levels
- Embeds
- Overwriting username and avatar_url