# logol

> Simple wrapper of console.log to had some color in the terminal.

Latest version **0.1.0** (published 2020-07-03) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2020-07-03 |
| First published | 2019-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 18.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alexandre Piel |
| Maintainers | apiel |

## Links

- npm: https://www.npmjs.com/package/logol
- Repository: https://github.com/apiel/logol
- Homepage: https://github.com/apiel/logol#readme
- Issues: https://github.com/apiel/logol/issues
- npm.io page: https://npm.io/package/logol

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [typescript](https://npm.io/package/typescript.md) ^3.9.6

## Recent versions

- 0.1.0 (latest) — 2020-07-03
- 0.0.3 — 2019-05-11
- 0.0.2 — 2019-04-29
- 0.0.1 — 2019-04-28

## README

# logol

Simple wrapper of console.log to had some color in the terminal.

## Node

```sh
yarn add logol
or
npm install logol
```

```js
const logol = require('logol');

logol.info('test info', { a: 123 });
logol.log('test log', { a: 123 });
logol.success('test success', { a: 123 });
logol.debug('test debug', { a: 123 });
logol.warn('test warn', { a: 123 });
logol.error('test error', { a: 123 });

// or

import { info, log, success, debug, warn, error } from 'logol';

info('test info', { a: 123 });
log('test log', { a: 123 });
success('test success', { a: 123 });
debug('test debug', { a: 123 });
warn('test warn', { a: 123 });
error('test error', { a: 123 });
```

Will output:

![screenshot](https://github.com/apiel/logol/blob/master/media/logol.png?raw=true)

## Deno

```ts
import {
    info,
    log,
    success,
    debug,
    warn,
    error,
} from 'https://raw.githubusercontent.com/apiel/logol/master/mod.ts';

info('test info', { a: 123 });
log('test log', { a: 123 });
success('test success', { a: 123 });
debug('test debug', { a: 123 });
warn('test warn', { a: 123 });
error('test error', { a: 123 });
```

## Experimental features

> This are experimental features.

### Filter log

#### Filter by stack trace

In some case you might want to filter some specific logs. To do this, use environment variable `LOGOL_FILTER` by passing a regex. This regex will be applied on the stacktrace of the function calling the log. E.g: this is the stacktrace `at run (/home/user/test.js:4:7)`, to display only this log we could do `LOGOL_FILTER=test.js`.

To show the stacktrace of the log, use the enironment variable `LOGOL_SHOW_STACK=true`.

#### Filter by level

To only show some specific log level, use environment variable `LOGOL_LEVELS` where we can define wich log level to display, e.g.: `LOGOL_LEVELS=error,warn` (each level is seprated by a "," without spacing)

### Overwrite logol

In some case, we might need to overwrite the logger, for example to do unit test.

```ts
logol.logol.log = (...params) => console.log('overwrite', ...params);
logol.log('test log', { a: 123 });
```

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