Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

updatable-log

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

updatable-log

pretty logger with the ability to update lines in place

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

updatable-log

pretty logger with the ability to update lines in place

Example

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

Keywords

FAQs

Package last updated on 05 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc