JSPM

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

Basic logging utils: colors, symbols and timestamp.

Package Exports

  • log-utils

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

Readme

log-utils NPM version NPM downloads Build Status

Basic logging utils: colors, symbols and timestamp.

Install

Install with npm:

$ npm install log-utils --save

All module dependencies are tiny and are lazily evaluated, this takes around ~1 millisecond to load.

Usage

var lu = require('log-utils');

API

.symbol.error

Error symbol.

Example

console.log(utils.symbol.error);
//=> ✖

.symbol.info

Info symbol.

Example

console.log(utils.symbol.info);
//=> ℹ

.symbol.success

Success symbol.

Example

console.log(utils.symbol.success);
//=> ✔

.symbol.warning

Warning symbol.

Example

console.log(utils.symbol.warning);
//=> ⚠

.error

Get a red error symbol.

Example

console.log(utils.error);
//=> ✖

.info

Get a cyan info symbol.

Example

console.log(utils.info);
//=> ℹ

.success

Get a green success symbol.

Example

console.log(utils.success);
//=> ✔

.warning

Get a yellow warning symbol.

Example

console.log(utils.warning);
//=> ⚠

.timestamp

Get a formatted timestamp.

Example

console.log(utils.timestamp);
//=> [15:27:46]

.ok

Log a white success message prefixed by a green check.

Example

utils.ok('Alright!');
//=> '✔ Alright!'

.spinner

Start a basic terminal spinner. Currently this only allows for one spinner at a time, but there are plans to allow multiple named spinners.

Example

utils.spinner('downloading...');

.spinner.stop

Stop a spinner.

Example

utils.spinner.stop('finished downloading');

.spinner.startTimer

Start a timer with a spinner. Requires an instance of [time-diff][] as the first argument.

Example

var Time = require('time-diff');
var time = new Time();
utils.spinner.startTimer(time, 'foo', 'downloading');

.spinner.stopTimer

Stop a spinner-timer.

Example

utils.spinner.stopTimer(time, 'foo', 'finished downloading');

Colors

Available colors from ansi-colors:

  • .bgblack()
  • .bgblue()
  • .bgcyan()
  • .bggreen()
  • .bgmagenta()
  • .bgred()
  • .bgwhite()
  • .bgyellow()
  • .black()
  • .blue()
  • .bold()
  • .cyan()
  • .dim()
  • .gray()
  • .green()
  • .grey()
  • .hidden()
  • .inverse()
  • .italic()
  • .magenta()
  • .red()
  • .reset()
  • .strikethrough()
  • .underline()
  • .white()
  • .yellow()

You might also be interested in these projects:

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v0.9.0, on April 21, 2016.