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

nooks-logger

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nooks-logger

Logger for Node.js

  • 1.0.2
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Classes

Logger

Logger

new Logger(serviceName, options)

Creates a JSON Logger for Node Applications

ParamTypeDescription
serviceNameStringName of the service or application.
optionsObjectConfiguration options.
options.levelStringMinimum level logged. Static fields are provided for convenience: Logger.DEBUG, Logger.INFO, Logger.WARN, Logger.ERROR, and Logger.FATAL. Defaults to Logger.INFO.
options.metadataObjectInitial fields to include with every log from logger instance

logger.debug(message, data)

Writes a debug JSON log to the console.

ParamTypeDescription
messagestringlog message.
metadataObjectextra metadata associated with the log.

logger.info(message, data)

Writes an info JSON log to the console.

ParamTypeDescription
messagestringlog message.
metadataObjectextra metadata associated with the log.

logger.warn(message, data)

Writes a warning JSON log to the console.

ParamTypeDescription
messagestringlog message.
metadataObjectextra metadata associated with the log.

logger.error(message, data)

Writes an error JSON log to the console.

ParamTypeDescription
messagestringlog message.
metadataObjectextra metadata associated with the log.

logger.fatal(message, data)

Writes a fatal JSON log to the console.

ParamTypeDescription
messagestringlog message.
metadataObjectextra metadata associated with the log.

logger.err(error) ⇒ Logger

Creates a new logger with the error field set at root to be serialized nicely.

Returns: Logger - returns child logger to log a unit of work.

ParamTypeDescription
errorErrora javascript Error.

logger.data(data) ⇒ Logger

Chainable command to define extra metadata to be included in all subsequent logs.

Returns: Logger - returns child logger that will include extra metadata in all subsequent logs.

ParamTypeDescription
dataObjecttop-level data to add to logs.

FAQs

Package last updated on 20 Jun 2023

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