Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-discord-logger

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-discord-logger

Nodejs logger for Discord

  • 1.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
73
decreased by-43.41%
Maintainers
1
Weekly downloads
 
Created
Source

Node Discord Logger

Send logs to Discord from your NodeJS application. See detailed documentation

Installation

npm i -S node-discord-logger

Initialization

import DiscordLogger from 'node-discord-logger';

const logger = new  DiscordLogger({
  hook: 'https://your/discord/webhook',
  icon: 'https://icon/for/service', // optional, will be included as an icon in the footer
  serviceName: 'My NodeJS Service', // optional, will be included as text in the footer
  defaultMeta: {                    // optional, will be added to all the messages
    'Process ID': process.pid,
    Host: os.hostname(),            // import os from 'os';
  },
  errorHandler: err => {            // optional, if you don't want this library to log to console
    console.error('error from discord', err);
  }
});

Usage

  • Error Message
logger.error({
  message: 'This is an error message',
  error: new Error('sample error') // This field can be included in other log functions as well
});

error message example

  • Warning Message
logger.warn({ message: 'This is warning message' });

warning message example

  • Debug Message
logger.debug({
  message: 'This is a debug message',
  json: { debug: 'data' } // This field can be included in other log functions as well
});

debug message example

  • Info Message
logger.info({
  message: 'This is a info message',
  description: 'Some additional description' // This field can be included in other log functions as well
});

info message example

  • Verbose Message
logger.verbose({ message: 'This is a verbose message' });

verbose message example

  • Silly Message
logger.silly({ message: 'This is a silly message' });

silly message example

LogMessage

FieldTypeDescriptionRequired
messagestringMain log messageyes
descriptionstringLog message descriptionno
errorErrorError object to be logged with the messageno
meta{ [key: string]: string | number | Date }Meta details for log messageno
jsonany (Valid JSON object)Additional JSON to be logged in discord messageno

Changelog

v1.1.0

  • Added description field in log message. See usage.

Keywords

FAQs

Package last updated on 01 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc