# updatable-log

> pretty logger with the ability to update lines in place

Latest version **0.2.0** (published 2019-09-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install updatable-log
pnpm add updatable-log
yarn add updatable-log
bun add updatable-log
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2019-09-05 |
| First published | 2018-10-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Noah Sugarman |
| Maintainers | noahsug |
| Keywords | log, update, logger |

## Links

- npm: https://www.npmjs.com/package/updatable-log
- Repository: https://github.com/noahsug/updatable-log
- Homepage: https://github.com/noahsug/updatable-log#readme
- Issues: https://github.com/noahsug/updatable-log/issues
- npm.io page: https://npm.io/package/updatable-log

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [figures](https://npm.io/package/figures.md) ^3.0.0
- [log-update](https://npm.io/package/log-update.md) ^3.3.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.2.0 (latest) — 2019-09-05
- 0.1.0 — 2018-10-15

## README

# updatable-log
> pretty logger with the ability to update lines in place

## Example
```js
const log = require('updatable-log');
const chalk = require('chalk');
const delay = require('delay');

async function exampleApp({ quiet }) {
  // ignore everything except log.important() and log.error()
  log.quiet = quiet;

  log.info(chalk.green('E X A M P L E - A P P'));
  log.info('v1.2.0');

  for (let page = 0; page < 40; page++) {
    await fetchData(page);
  }

  log.clear();
  console.log('call log.clear() before printing with the built-in console.log()');

  try {
    printResult();
  } catch (e) {
    log.error(e);
  }
}

async function fetchData(page) {
  log.update('fetching data from:', `http://get-data.com?page=${page}`);
  await delay(100);

  if (page === 10) {
    log.warn('invalid data, skipping page', page);
  }
}

function printResult() {
  log.important(
    JSON.stringify(
      {
        age: 6,
        name: 'Ender Wiggin',
      },
      null,
      2
    )
  );

  this.will.throw.a.null.pointer.exception();
}

```

To run this example yourself:
```
git clone https://github.com/noahsug/updatable-log.git
cd updatable-log
npm i
npm run example
```

---
_Source: https://npm.io/package/updatable-log · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
