1.0.0 • Published 7 years ago

series-logger v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

series-logger

Log a series w/ spinner and op count

Made with ❤ at @outlandish

Install

npm install --save series-logger
yarn add series-logger

Import

// ES2015
import log from 'series-logger' 
// CommonJS
var log = require('series-logger') 

Usage

series(number) : Function

  • number {Number} The number of log operations in the series

Returns a function that can be called number times.

Each invocation should be passed a message and returns an instance of ora.

For details on ora see it's GitHub repo.

Example

const log = series(5)

var operation = log('first operation').start()
//=> {spinner} [1/5] first operation

doSomethingAsync()
  .then(() => operation.success()) //=> {tick} [1/5] first operation 
  .catch(() => operation.fail()) //=> {cross} [1/5] first operation

log('second operation').start()
//=> {spinner} [2/5] second operation

// ...and so on

License

MIT © Sam Gluck

Contributing

All pull requests and issues welcome!

If you're not sure how, check out the great video tutorials on egghead.io!