# hapi-good-winston

> A hapi good reporter to log events with winston

Latest version **3.0.1** (published 2020-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install hapi-good-winston
pnpm add hapi-good-winston
yarn add hapi-good-winston
bun add hapi-good-winston
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2020-07-17 |
| First published | 2016-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 16.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Alexandre BODIN |
| Maintainers | alexandrebodin |
| Keywords | hapi, good, goodjs, winston, winstonjs, reporter, good-reporter, hapijs |

## Links

- npm: https://www.npmjs.com/package/hapi-good-winston
- Repository: https://github.com/alexandrebodin/hapi-good-winston
- Issues: https://github.com/alexandrebodin/hapi-good-winston/issues
- npm.io page: https://npm.io/package/hapi-good-winston

## Dependencies (4)

- [winston](https://npm.io/package/winston.md) 2.x || 3.x
- [@hapi/good](https://npm.io/package/@hapi/good.md) ^8.0
- [@hapi/hapi](https://npm.io/package/@hapi/hapi.md) ^18.0
- [json-stringify-safe](https://npm.io/package/json-stringify-safe.md) ^5.0.1

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

- 3.0.1 (latest) — 2020-07-17
- 0.1.0 (beta) — 2016-06-23
- 3.0.0 — 2019-06-30
- 2.1.0 — 2018-10-29
- 2.0.1 — 2018-05-15
- 1.1.4 — 2018-01-29
- 2.0.0-rc1 — 2018-01-28
- 2.0.0 — 2018-01-28
- 1.1.3 — 2018-01-28
- 1.1.2 — 2017-11-05
- 1.1.1 — 2017-01-05
- 1.1.0 — 2016-07-28
- 1.0.0 — 2016-07-22
- 0.1.2 — 2016-06-23
- 0.1.1 — 2016-06-23

## README

# hapi-good-winston

A good reporter to send and log events with winston

[![npm](https://img.shields.io/npm/v/hapi-good-winston.svg?style=flat-square)](https://www.npmjs.com/package/hapi-good-winston)
[![npm](https://img.shields.io/npm/dm/hapi-good-winston.svg?style=flat-square)](https://www.npmjs.com/package/hapi-good-winston)
[![license](https://img.shields.io/github/license/alexandrebodin/hapi-good-winston.svg?style=flat-square)](https://opensource.org/licenses/MIT)

[![CircleCI](https://img.shields.io/circleci/project/alexandrebodin/hapi-good-winston.svg?style=flat-square)](https://circleci.com/gh/alexandrebodin/hapi-good-winston)
[![Dependency Status](https://dependencyci.com/github/alexandrebodin/hapi-good-winston/badge?style=flat-square)](https://dependencyci.com/github/alexandrebodin/hapi-good-winston)

[![Issues](https://img.shields.io/github/issues-raw/alexandrebodin/hapi-good-winston.svg?style=flat-square)](https://github.com/alexandrebodin/hapi-good-winston/issues)
[![PR](https://img.shields.io/github/issues-pr-raw/alexandrebodin/hapi-good-winston.svg?style=flat-square)](https://github.com/alexandrebodin/hapi-good-winston/pulls)

## Disclaimer

-   Use `v3.*` for hapi >= 18

-   Use `v2.*` for version prior to hapi v18

*   Use `v1.*` for version prior to hapi v17

## Installation

```bash
$ npm install --save hapi-good-winston
```

## Usage

```javascript
import { Server } from 'hapi';
import winston from 'winston';
import goodWinston from 'hapi-good-winston';

const logger = winston.createLogger({
    level: 'info',
    format: winston.format.json(),
    transports: [new winston.transports.Console()],
});

const server = new Server();

// Set winston minimum log level to debug
// winston.level = 'debug';

// Only the 'response' and 'error' event levels will be overwritten
const goodWinstonOptions = {
    levels: {
        response: 'debug',
        error: 'info',
    },
};

const options = {
    ops: {
        interval: 1000,
    },
    reporters: {
        // Simple and straight forward usage
        winston: [goodWinston(logger)],
        // Adding some customization configuration
        winstonWithLogLevels: [goodWinston(logger, goodWinstonOptions)],
        // This example simply illustrates auto loading and instantiation made by good
        winston2: [
            {
                module: 'hapi-good-winston',
                name: 'goodWinston',
                args: [logger, goodWinstonOptions],
            },
        ],
    },
};

server
    .register({
        plugin: require('good'),
        options,
    })
    .then(() => {
        return server.start();
    })
    .then(() => {
        console.info(`Server started at ${server.info.uri}`);
    });
```

# Links

-   [Hapi](https://github.com/hapijs/hapi)
-   [Good](https://github.com/hapijs/good)
-   [Winston](https://github.com/winstonjs/winston)

# License

[MIT](LICENSE)

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