JSPM

stupid-log

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

Really simple logging utility. Logs to stderr.

Package Exports

  • stupid-log

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 (stupid-log) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Logging utility for Node.js/io.js. Logs to stderr.

Designed to be as simple as possible. No:

  • dependencies;
  • log level control;
  • colors;
  • log servers.

Supports:

  • named logs;
  • four levels: default, warn, error, TODO.

Installation

$ npm install stupid-log

Usage

Top-level log:

var log = require('stupid-log');

log('obj:', { x: 1 });
// obj: { x: 1 }

log.warn('obj:', { x: 1 });
// {WARN} obj: { x: 1 }

log.error('obj:', { x: 1 });
// {ERROR} obj: { x: 1 }

log.TODO('handle this case properly');
// {TODO} handle this case properly

Named log:

var log = require('stupid-log').for('component');

log('obj:', { x: 1 });
// [component] obj: { x: 1 }

log.warn('obj:', { x: 1 });
// [component] {WARN} obj: { x: 1 }

log.error('obj:', { x: 1 });
// [component] {ERROR} obj: { x: 1 }

log.TODO('handle this case properly');
// [component] {TODO} handle this case properly

As separate functions (ES6 syntax):

const log = require('stupid-log').for('component'),
  {warn, error, TODO} = log;

log('obj:', { x: 1 });
warn('obj:', { x: 1 });
error('obj:', { x: 1 });
TODO('handle this case properly');