Skip to content

maleta/discord-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

discord logger

Dependency

  • request library for sending requests

Installation

Using npm:

$ npm install discord-logger

How to use

In Node.js:

const DiscordLogger = require('discord-logger');
const options = {
  endpoint: process.env.DISCORD_WEBHOOK,
  botUsername: 'my app logger'
  infoPrefix: ':information_source:' // optional, default value is :information_source:,
  successPrefix: ':white_check_mark:' // optional, default value is :white_check_mark:,
  errorPrefix: ':sos:' // optional, default value is :sos:
}

const logger = new DiscordLogger(options);

// Send message to discord channel associated with provided hook
logger.info('This is regular info message.');
logger.success('Another message, but very successful this time.');
logger.error('Oops! Something is wrong!');

Output:

Author

maleta

Licence

MIT

About

Log events from nodejs to discord using webhooks

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published