JSPM

spiffy-console

0.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q27617F
  • License SEE LICENSE IN license

color coded console output and stack traces

Package Exports

  • spiffy-console

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

Readme

spiffy-console

color coded console output and nice stack traces(uses stacky) for nodejs.

Example Spiffy Console

How To Use

var options = {
  level: 4,
  //optional
  /**
  colors: {
    trace:208,
    error: 196,
    warn: 193,
    info: 177,
    log: 118
  }
  */
}

/*
 * if set to true it will replace the global console functions with
 * spiffy functions so that any call to console.* will call the
 * spiffy equivalent
 */
var replaceConsole = false;

var spiffy = require('spiffy-console')(options, replaceConsole);

spiffy.log("hello", "log");
spiffy.info("hello", "info");
spiffy.warn("hello", "warn");
spiffy.error("hello", "error");
spiffy.trace(new Error('some error'));

Option Defaults

const defaults = {
  /*
   * print up to level 4
   *
   * levels:
   * - trace: 0
   * - error: 1
   * - warn: 2
   * - info: 3
   * - log: 4
   */
  level:4,
  /*
   * Xterm color indices
   * https://jonasjacek.github.io/colors/
   */
  colors: {
    trace:13,
    error:9,
    warn:11,
    info:27,
    log:40,
    timestamp: 109,
    lineno: 108,
    funcname:7
   },
   prefix: {
    timestamp: {
      visible: true,
      /**
       * more about format strings here
       * https://www.npmjs.com/package/dateformat#mask-options
       */
      format: "isoUtcDateTime"
    },
    lineno: true,
    funcname: true
   }
}

Xterm Color indices

https://jonasjacek.github.io/colors/

Author

jmfairlie@gmail.com

License

MIT