# uilog

> Logging interface for somewhat pretty CLI apps

Latest version **1.0.1** (published 2015-12-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install uilog
pnpm add uilog
yarn add uilog
bun add uilog
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-12-10 |
| First published | 2015-12-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Michael Contento |
| Maintainers | michaelcontento |
| Keywords | logging, ui, interface, spinner |

## Links

- npm: https://www.npmjs.com/package/uilog
- Repository: https://github.com/michaelcontento/uilog
- Issues: https://github.com/michaelcontento/uilog/issues
- npm.io page: https://npm.io/package/uilog

## Dependencies (1)

- [ansi](https://npm.io/package/ansi.md) ^0.3.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-12-10
- 1.0.0 — 2015-12-10

## README

# [uilog][]

[![build](https://travis-ci.org/michaelcontento/uilog.svg)](https://travis-ci.org/michaelcontento/uilog)
[![dependencies](https://david-dm.org/michaelcontento/uilog.svg)](https://david-dm.org/michaelcontento/uilog)
[![devDependencies](https://david-dm.org/michaelcontento/uilog/dev-status.svg)](https://david-dm.org/michaelcontento/uilog#info=devDependencies)

[![license](https://img.shields.io/npm/l/uilog.svg?style=flat-square)](https://www.npmjs.com/package/uilog)
[![npm version](https://img.shields.io/npm/v/uilog.svg?style=flat-square)](https://www.npmjs.com/package/uilog)
[![npm downloads](https://img.shields.io/npm/dm/uilog.svg?style=flat-square)](https://www.npmjs.com/package/uilog)

## Overview

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

### Simple output

You can log at various levels:

```js
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](./imgs/log.png)

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.

```js
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](./imgs/async.gif)

### Nesting

With `namespace` you can create arbitraty deeply nested log output:

```js
import { namespace } from 'uilog';

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

![sample](./imgs/nesting.png)

## Installation

    npm install --save uilog

  [Avalon]: http://avalon.michaelcontento.de
  [uilog]: https://github.com/michaelcontento/uilog

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