npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

abstract-logging

1.0.0 • Public • Published

abstract-logging

This module provides an interface for modules to include so that they can support logging via an external logger that conforms to the standard Log4j interface. One such logger is Pino. This module is intended for modules that are meant to be used by other modules.

Example:

'use strict'
 
function AwesomeLibrary (options) {
  this.log = (options.logger) ? options.logger : require('abstract-logging')
}
 
AwesomeLibrary.prototype.coolMethod = function () {
  this.log.trace('AwesomeLibrary.coolMethod was invoked')
  return {}
}
 
module.exports = AwesomeLibrary

Interface

Available methods:

  • fatal
  • error
  • warn
  • info
  • debug
  • trace

All methods are no operation functions.

License

MIT License

install

npm i abstract-logging

Downloadsweekly downloads

35,746

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability