conflogger

1.0.5 • Public • Published

conflogger

Build Status NPM version

Small module for configuring a logger. Falls back to noops for methods that do not exist in the logger passed.

Installation

npm install conflogger --save

Usage

Conflogger can take a provided logger and fill methods that do not exist

const conflogger = require('conflogger');
 
let originalLogger = {
  info(msg) {
    console.log(msg);
  }
};
 
let logger = conflogger.configure(originalLogger);
 
// Prints `Conflogger!`
logger.info('Conflogger!');
 
// Prints `Error!`
logger.error('Error!');

Conflogger can give you a basic logger. Free. Of. Charge.

const conflogger = require('conflogger');
 
let logger = conflogger.configure(true);
 
// Prints `Conflogger!`
logger.info('Conflogger!');
 
// Prints `Error!`
logger.error('Error!');

Conflogger can even give you a noop logger. Woah.

const conflogger = require('conflogger');
 
let logger = conflogger.configure();
 
// Does not print anything
logger.info('Conflogger!');
 
// Does not print anything
logger.error('Error!');

Dependents (5)

Package Sidebar

Install

npm i conflogger

Weekly Downloads

61

Version

1.0.5

License

MIT

Last publish

Collaborators

  • austinkelleher