6.0.0 • Published 6 months ago

log-update v6.0.0

Weekly downloads
7,189,902
License
MIT
Repository
github
Last release
6 months ago

log-update

Log by overwriting the previous output in the terminal.\ Useful for rendering progress bars, animations, etc.

npm.io

Install

npm install log-update

Usage

import logUpdate from 'log-update';

const frames = ['-', '\\', '|', '/'];
let index = 0;

setInterval(() => {
	const frame = frames[index = ++index % frames.length];

	logUpdate(
`
        ♥♥
   ${frame} unicorns ${frame}
        ♥♥
`
	);
}, 80);

API

logUpdate(text…)

Log to stdout.

logUpdate.clear()

Clear the logged output.

logUpdate.done()

Persist the logged output.

Useful if you want to start a new log session below the current one.

logUpdateStderr(text…)

Log to stderr.

logUpdateStderr.clear()

logUpdateStderr.done()

createLogUpdate(stream, options?)

Get a logUpdate method that logs to the specified stream.

options

Type: object

showCursor

Type: boolean\ Default: false

Show the cursor. This can be useful when a CLI accepts input from a user.

import {createLogUpdate} from 'log-update';

// Write output but don't hide the cursor
const log = createLogUpdate(process.stdout, {
	showCursor: true
});

Examples

  • listr - Uses this module to render an interactive task list
  • ora - Uses this module to render awesome spinners
  • speed-test - Uses this module to render a spinner
listr-update-rendererlistr2@prisma/migrate@ricdotnet/cliarchetype-librarydgen-cli-v2@c8y/cli@theia/cli@yaitmou/create-web-projectcreate_your_simple_webappmangareader-dl@borie88/lucidweb-socket-handlervpn-checkhierarchy-clicli-xyc-demotn-illuminateairsdk-compilertwohundredadobe-air-sdk-and-compiler@yushicheng/create-private-libcreate-tizen-apppacman-baramazon-pacman@supersede/webpack-progress-pluginbb-chatphill@slaty/syncslatysw-deployjk-component-toolsyodlbyted-fe-ci@askphill/syncgql_din_modlansons-minererror-shots@jttechnic/interpreterlow-weight-package-managerpg-tube@newhorizon-tech/dd-npm-package-templatecogoportutilsastra-cli-kit@bud-tools/clicrdl@infinitebrahmanuniverse/nolb-log-@prodam/prodam-types@billomat/clidgen-cliexpand-react-bridgeaub-legos-libnetlify-cli@everything-registry/sub-chunk-2096chronos-package-managercricket-cli@supercharge/console-io@wammy19/sep-pdbs@vuminal/connector-tom@zkochan/remark@steveaxtmann/harvest-break-tracker@steve-moretz/ir-cli@steve-moretz/tcp-rock-paper-scissor-cli@yvu/driaaja@zpmpkg/zpm@types/log-updateacao@aureooms/listr-aggregate-rendererbanana-log@avrora.io/sdkbhd-burst-proxybhdproxy@czisis/pgconv@barelyhuman/wrapbigquery-porter@danielkalen/listrbi-vorpalbase-editor@cparra/apexdocsbaocrbatch-audio-converter@crherman7/reactor-corebb-auto-env-doctor@darwishdev/dash-dev@cryptocode99/token-listsbeech-apibacked-builderbacked-clibackend-testing-corebench4devbennyauto-friend@asiifdev/express-helper@asiz33/smartblok-vendure-plugin@ih/log-progresscllcexpress-server-kitcode-forgeespoir-cli@iamstarkov/listr-update-renderer
6.0.0

6 months ago

5.0.1

2 years ago

5.0.0

3 years ago

4.0.0

4 years ago

3.4.0

4 years ago

3.3.0

5 years ago

3.2.0

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.3.0

6 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago