0.2.1 • Published 1 year ago

@designble/log-utils v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

log-utils NPM version NPM downloads Build Status

Basic logging utils: colors, symbols and timestamp.

Install

Install with npm:

$ npm install --save log-utils

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

Usage

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

API

.symbol.error

Error symbol.

Example

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

.symbol.info

Info symbol.

Example

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

.symbol.success

Success symbol.

Example

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

.symbol.warning

Warning symbol.

Example

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

.error

Get a red error symbol.

Example

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

.info

Get a cyan info symbol.

Example

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

.success

Get a green success symbol.

Example

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

.warning

Get a yellow warning symbol.

Example

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

.timestamp

Get a formatted timestamp.

Example

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

.ok

Log a white success message prefixed by a green check.

Example

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

.heading

Make the given text bold and underlined.

Example

console.log(log.heading('foo'));
// or
console.log(log.heading('foo', 'bar'));

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

Changes

v0.2.0 (2016-07-16)

  • removed: all spinner methods

v0.1.5 (2016-07-16)

  • added: .header method
  • fixed: .ok method, so that whitespace is respected

Related projects

You might also be interested in these projects:

Contributing

This document was generated by verb-readme-generator (a verb generator), please don't edit directly. Any changes to the readme must be made in .verb.md. See Building Docs.

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

Or visit the verb-readme-generator project to submit bug reports or pull requests for the readme layout template.

Building docs

(This document was generated by verb-readme-generator (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

Generate readme and API documentation with verb:

$ npm install -g verb verb-readme-generator && 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 July 11, 2016.