🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

draftlog-session

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

draftlog-session

Session aware logs like Yarn with timings and steps

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Draftlog Session

Log like a pro with Yarn-like statuses

This will generate clean session logs for your "steps" during execution of scripts in node.

Here is an example (using async/await):

const Session = require('../')

const sleep = ms => new Promise((res, rej) => setTimeout(res, ms))

;(async () => {
  let session = new Session('Simple session')

  session.step = 'Initializing'
  await sleep(100)

  session.step = 'Doing something'
  session.status = 'One thing...'
  await sleep(400)
  session.status = 'One more thing...'
  await sleep(400)

  session.step = 'Finishing up'
  session.skip()

  session.step = 'Loading'
  let steps = 10
  session.startProgress(steps)
  while (steps--) {
    session.progress()
    await sleep(200)
  }

  session.step = 'Completed. Cleaning up'

  session.step = 'One more extra step...'

  session.finish()
})()

Keywords

chalk

FAQs

Package last updated on 24 Oct 2017

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