JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 608
  • Score
    100M100P100Q89494F
  • License MIT

A basic libray to stub logging calls when an external logger is expected.

Package Exports

  • logstub
  • logstub/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (logstub) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

logstub

NPM

Actual version published on npm Master build Total npm module downloads Codacy Badge Codacy Coverage Badge Dependencies badge

logstub is a basic library to stub logging calls when an external logger is expected to be passed to your libraries and applications.

Installation

$ npm install logstub

Usage

  const LogStub = require('logstub');

  class YourClass {
    constructor(logger) {
      // Stub out the logger when none is passed to the class constructor.
      this.logger = logger || new LogStub();
    }

    someMethod() {
      try {
        this.logger.info('Some Logging Info');
      } catch (err) {
        this.logger.error(err);
      }
    }
  }

API

The logging stub will handle method calls for log, silly, debug, info, verbose, warn, error, critical, fatal, trace, and all with any number of parameters making it compatible for stubbing general logging from a number of popular logging libraries such as Winston, Log4JS, and Bunyan.

It also supports all standard console methods.

License

Copyright (c) 2017-2019 Jay Reardon Copyright (c) 2019-2021 Out of Sync Studios Licensed under the MIT license.