# console-augmenter

> Augments logging via the console object with log levels and other useful stuff

Latest version **0.0.3** (published 2018-10-19) · AGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install console-augmenter
pnpm add console-augmenter
yarn add console-augmenter
bun add console-augmenter
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2018-10-19 |
| First published | 2018-10-01 |
| Weekly downloads | 0 |
| License | AGPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 352.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ronald Toussaint |
| Maintainers | rotous |
| Keywords | logger, log, console |

## Links

- npm: https://www.npmjs.com/package/console-augmenter
- Repository: https://github.com/rotous/console-augmenter
- Homepage: https://github.com/rotous/console-augmenter#readme
- Issues: https://github.com/rotous/console-augmenter/issues
- npm.io page: https://npm.io/package/console-augmenter

## 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

- 0.0.3 (latest) — 2018-10-19
- 0.0.2 — 2018-10-02
- 0.0.1 — 2018-10-01

## README

# console-augmenter

All modern browsers and NodeJS support the functions `console.debug()`, `console.log()`, `console.info()`,
`console.warn()` and `console.error()`. And some browsers even have a feature to only
show what you want in the developer tools console.

This module however adds functionality to set the log level in the code. This way you can
leave your debug logging in your code and just set another log level for your production
build so the end user will not see the logs.

## Installation
If you have an NPM project you can use:

```
npm install console-augmenter
```

and include the script as

```
import 'console-augmenter';
```

Otherwise you can download the `bundle.min.js` (together with `bundle.min.js.map`), put it somewhere in your project and
add it to your html with:

```
<script src='<LOCATION_RELATIVE_TO_YOUR_HTML_FILE/>bundle.min.js'></script>
```

## Usage
When you have included the script, you can just use the functions `console.debug`, `console.log`, `console.info`,
`console.warn` and `console.error` just like you are used to.

Change the log level of your application by calling the `logLevel()` function:

```
console.logLevel(console.LL_ERROR); // only log error messages
```

Use one of these log levels:
- console.LL_ALL
- console.LL_LOG
- console.LL_INFO
- console.LL_WARN
- console.LL_ERROR
- console.LL_NONE

Add timestamps to your logs with the `addTimestamps()` function:

```
console.addTimestamps(true);
console.log('Hello world!); \\ [date - time] Hello world!
console.addTimestamps(false);
console.log('Hello world!); \\ Hello world!
```

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