New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

uilog

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

uilog

Logging interface for somewhat pretty CLI apps

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

uilog

build dependencies devDependencies

license npm version npm downloads

Overview

Use this module to create somewhat pretty CLI apps (like Avalon).

Simple output

You can log at various levels:

import { debug, info, warn, error } from 'uilog';

debug('hidden by default');
info('visible by default');
warn('vibisble by default and yellow');
error('visible by default and red');

sample

Use setVerbose(true) to change the visiblity of debug rows.

Async output

But it's also possible to log async tasks with a spinner! They do follow the same visibility / styling rules as the normal logging functions.

import { debugWait, infoWait, warnWait, errorWait } from 'uilog';

const ok = infoWait('Processing ...');
setTimeout(ok.done, 3000);

const error = warnWait('Waiting for a lock to be released ...');
setTimeout(error.error, 2000);

const hide = errorWait('Waiting for required clients ...');
setTimeout(hide.clear, 1000);

const download = infoWait('Downloading a file ...');
setTimeout(() => download.setProgress(5), 0);
setTimeout(() => download.setProgress(10), 500);
setTimeout(() => download.setProgress(20), 1000);
setTimeout(() => download.setProgress(30), 1500);
setTimeout(() => download.setProgress(40), 2000);
setTimeout(() => download.setProgress(50), 2500);
setTimeout(() => download.setProgress(60), 3000);
setTimeout(() => download.setProgress(70), 3500);
setTimeout(() => download.setProgress(80), 4000);
setTimeout(() => download.setProgress(90), 4500);
setTimeout(() => download.setProgress(100), 5000);
setTimeout(download.done, 5250);

sample

Nesting

With namespace you can create arbitraty deeply nested log output:

import { namespace } from 'uilog';

namespace('some')
    .namespace('deep')
        .namespace('nesting')
            .info('hi!');

sample

Installation

npm install --save uilog

Keywords

logging

FAQs

Package last updated on 10 Dec 2015

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