https://github.com/sdgluck/series-logger
Log a series w/ spinner and op count
https://github.com/sdgluck/series-logger
Last synced: 8 months ago
JSON representation
Log a series w/ spinner and op count
- Host: GitHub
- URL: https://github.com/sdgluck/series-logger
- Owner: sdgluck
- Created: 2017-07-26T13:02:17.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-26T13:04:13.000Z (almost 9 years ago)
- Last Synced: 2025-09-04T09:30:46.880Z (9 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# series-logger
> Log a series w/ spinner and op count
Made with ❤ at @outlandish
## Install
```bash
npm install --save series-logger
```
```bash
yarn add series-logger
```
## Import
```js
// ES2015
import log from 'series-logger'
```
```js
// 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](https://github.com/sindresorhus/ora).
## Example
```js
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](github.com/sdgluck)
## Contributing
All pull requests and issues welcome!
If you're not sure how, check out the [great video tutorials on egghead.io](http://bit.ly/2aVzthz)!