# logslot

> A tiny logger that outputs json at runtime and pretty logs during development

Latest version **2.1.1** (published 2022-05-21) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2022-05-21 |
| First published | 2021-02-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 78.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | markwylde |

## Links

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

## Dependencies (1)

- [chalk](https://npm.io/package/chalk.md) ^5.0.1

## Recent versions

- 2.1.1 (latest) — 2022-05-21
- 2.1.0 — 2021-06-12
- 2.0.3 — 2021-06-12
- 2.0.2 — 2021-06-12
- 2.0.1 — 2021-06-12
- 2.0.0 — 2021-06-12
- 1.0.3 — 2021-02-23
- 1.0.2 — 2021-02-23
- 1.0.0 — 2021-02-23

## README

# logslot
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/markwylde/logslot)
[![GitHub package.json version](https://img.shields.io/github/package-json/v/markwylde/logslot)](https://github.com/markwylde/logslot/releases)
[![GitHub](https://img.shields.io/github/license/markwylde/logslot)](https://github.com/markwylde/logslot/blob/master/LICENSE)

A tiny logger that outputs json at runtime and pretty logs during development

## Example Usage
```javascript
const logslot = require('logslot');
logslot('myapp.test.one').error('some error', { extraThings: 1 })
logslot('myapp.test.one').warn('a warning', { extraThings: 2 })
logslot('myapp.test.one').info('for your info', { extraThings: 3 })
logslot('myapp.test.one').verbose('lots of detail', { extraThings: 4 })
logslot('myapp.test.one').debug('for the devs', { a: 1, b: 2 })
logslot('myapp.test.two').info('different namespace', { extraThings: 10 })
```

### Output (json)
```json
["23/02/2021 10:57:37 pm","myapp:test:one","ERROR","some error"]
["23/02/2021 10:57:37 pm","myapp:test:one","WARN","a warning"]
["23/02/2021 10:57:37 pm","myapp:test:one","INFO","for your info"]
["23/02/2021 10:57:37 pm","myapp:test:two","VERBOSE","lots of detail"]
["23/02/2021 10:57:37 pm","myapp:test:two","DEBUG","for the devs",{"a":1,"b":2}]
["23/02/2021 10:57:37 pm","myapp:test:two","INFO","different namespace",{"extraThings":10}]
```

### Log level
You can set the log level from an environment variable:
```bash
LOGSLOT_LEVEL=debug
```

Or with code:
```javascript
const logslot = require('logslot');
logslot.setLogLevel('debug');
```

### Output (pretty)
```bash
LOGSLOT_FORMAT=pretty
```

![screenshot](screenshot.png)

## License
This project is licensed under the terms of the MIT license.

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