# @openfin/simple-winston

> Basic winston with basic log level support

Latest version **2.0.0** (published 2017-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @openfin/simple-winston
pnpm add @openfin/simple-winston
yarn add @openfin/simple-winston
bun add @openfin/simple-winston
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2017-08-10 |
| First published | 2017-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | OpenFin |
| Maintainers | joneit, robotmayo, vsergeon, tgoc99, dwaynekj, datamadic, rdepena |

## Links

- npm: https://www.npmjs.com/package/@openfin/simple-winston
- Repository: https://github.com/openfin/simple-winston
- Homepage: https://github.com/openfin/simple-winston#readme
- Issues: https://github.com/openfin/simple-winston/issues
- npm.io page: https://npm.io/package/@openfin/simple-winston

## Dependencies (5)

- [chalk](https://npm.io/package/chalk.md) ^2.1.0
- [kind-of](https://npm.io/package/kind-of.md) ^5.0.2
- [winston](https://npm.io/package/winston.md) ^2.3.1
- [@types/node](https://npm.io/package/@types/node.md) ^8.0.20
- [@types/winston](https://npm.io/package/@types/winston.md) ^2.3.4

## Recent versions

- 2.0.0 (latest) — 2017-08-10
- 1.0.1 — 2017-08-09
- 1.0.0 — 2017-08-09

## README

simple-winston
==============

Simple consistent logging.

`npm i @openfin/simple-winston`

## Usage

`simple-winston` exposes a function that returns a winston logger. Its a simple wrapper on winston.loggers.get.

```javascript
import makeLogger from 'simple-winston'
const logger = makeLogger("some-label", "warn", true);
logger.info("Hi we are logging!");
```

## Arguments

### `idLabel:string`

The label and internal winston id.

### `level:string`
Valid values are: `silly info debug warn error`

Defaults to whatever is in NODE_DEBUG otherwise sets to `debug`. When this is set that logger will only output logs with a level higher or equal to. We reccomond setting the `NODE_DEBUG` environment variable instead of setting this yourself.

### `colorize:boolean`
If the environment variable `NODE_ENV` is set to production this defaults to false otherwise its set to true.

### `NODE_DEBUG_ONLY`

`simple-winston` also looks for the environemnt variable `NODE_DEBUG_ONLY`. This allows you to filter logs by label/id. Uses `string.startsWith` for matches, use commas to seperate labels. Example:
```javascript
import makeLogger from 'simple-winston'
const loga = makeLogger("loga");
const logb = makeLogger("logb");
const someOtherLog = makeLogger("someOtherLog");
loga.info("I will get logged")
logb.info("I will also get logged");
someOtherLog.info("I will be sileneced");
==============
NODE_DEBUG_ONLY=log node test.js
```

Can be combined with `NODE_DEBUG` to limit levels as well as ids.

## Format
Logs are always in this format. `<ISO string> - <level>: [<label>] ...your-text`

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