# console-log-level

> The most simple logger imaginable

Latest version **1.4.1** (published 2019-03-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install console-log-level
pnpm add console-log-level
yarn add console-log-level
bun add console-log-level
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.1 |
| Published | 2019-03-16 |
| First published | 2015-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/console-log-level) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 113 |
| Author | Thomas Watson Steen |
| Maintainers | watson |
| Keywords | log, logging, logger, console, console.log, stdout, stderr |

## Links

- npm: https://www.npmjs.com/package/console-log-level
- Repository: https://github.com/watson/console-log-level
- Issues: https://github.com/watson/console-log-level/issues
- npm.io page: https://npm.io/package/console-log-level

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.4.1 (latest) — 2019-03-16
- 1.4.0 — 2016-11-24
- 1.3.0 — 2016-07-07
- 1.2.1 — 2015-11-08
- 1.2.0 — 2015-10-02
- 1.1.2 — 2015-09-15
- 1.1.1 — 2015-09-15
- 1.1.0 — 2015-07-07
- 1.0.0 — 2015-01-05

## README

# console-log-level

A dead simple logger. Will log to STDOUT or STDERR depending on the
chosen log level. It uses `console.info`, `console.warn` and
`console.error` and hence supports the same API.

Log levels supported: trace, debug, info, warn, error and fatal.

[![npm](https://img.shields.io/npm/v/console-log-level.svg)](https://www.npmjs.com/package/console-log-level)
[![Build status](https://travis-ci.org/watson/console-log-level.svg?branch=master)](https://travis-ci.org/watson/console-log-level)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

## Installation

```
npm install console-log-level
```

## Example usage

```js
var log = require('console-log-level')({ level: 'info' })

log.trace('a') // will not do anything
log.debug('b') // will not do anything
log.info('c')  // will output 'c\n' on STDOUT
log.warn('d')  // will output 'd\n' on STDERR
log.error('e') // will output 'e\n' on STDERR
log.fatal('f') // will output 'f\n' on STDERR
```

## Options

Configure the logger by passing an options object:

```js
var log = require('console-log-level')({
  prefix: function (level) {
    return new Date().toISOString()
  },
  level: 'info'
})
```

### level

A `string` to specify the log level. Defaults to `info`.

### prefix

Specify this option if you want to set a prefix for all log messages.
This must be a `string` or a `function` that returns a string.

Will get the level of the currently logged message as the first
argument.

### stderr

A `boolean` to log everything to stderr. Defauls to `false`.

## License

[MIT](LICENSE)

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