1.0.2 • Published 1 year ago
log4js-discord v1.0.2
Discord Appender for log4js-node
Sends log events to a Discord channel. This is an optional appender for use with log4js.
npm install log4js-discordConfiguration
type-log4js-discordurl-string-your Discord Webhook URL (see the discord docs)icon_url-string(optional) - the icon to use for the messageusername-string- the username to display with the messagelayout-object(optional, defaults tobasicLayout) - the layout to use for the message (see layouts).
Example
log4js.configure({
appenders: {
alerts: {
type: 'log4js-discord',
url: 'https://discord.com/api/webhooks/...',
username: 'our_application'
}
},
categories: {
default: { appenders: ['alerts'], level: 'error' }
}
});This configuration will send all error (and above) messages, with the username our_application.