# winston-restify

> Another transport to sending logs with winston.

Latest version **0.0.2** (published 2018-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install winston-restify
pnpm add winston-restify
yarn add winston-restify
bun add winston-restify
```

## 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.2 |
| Published | 2018-05-30 |
| First published | 2018-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >8.0.0 |
| Dependencies | 3 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Carvalho, Vinicius Luiz |
| Maintainers | carvalho.viniciusluiz |
| Keywords | node, winston, restify, winston restify, restify clients, logger, jest |

## Links

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

## Dependencies (3)

- [winston](https://npm.io/package/winston.md) ^2.4.2
- [assert-plus](https://npm.io/package/assert-plus.md) ^1.0.0
- [restify-clients](https://npm.io/package/restify-clients.md) ^2.0.2

## 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.2 (latest) — 2018-05-30
- 0.0.1 — 2018-05-29

## README

# winston-restify
Another transport to sending logs with winston. Inspired by [winston-endpoint](https://github.com/gswalden/winston-endpoint)

[![standard][standard-image]][standard-url]
[![travis][travis-image]][travis-url]
[![Code Coverage][coverage-image]][coverage-url]
[![npm][npm-image]][npm-url]

[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[standard-url]: http://standardjs.com/
[travis-image]: https://travis-ci.org/carvalhoviniciusluiz/winston-restify.svg?branch=master
[travis-url]: https://travis-ci.org/carvalhoviniciusluiz/winston-restify
[coverage-image]: https://scrutinizer-ci.com/g/carvalhoviniciusluiz/winston-restify/badges/quality-score.png?b=master
[coverage-url]: https://scrutinizer-ci.com/g/carvalhoviniciusluiz/winston-restify/?branch=master
[npm-image]: https://img.shields.io/npm/v/winston-restify.svg?style=flat
[npm-url]: https://npmjs.org/package/winston-restify


### Installation:
```
npm install winston-restify --save
```

### Note:
Requires Node ``>8.0.0``.

### API Options:
Key | Description
------------ | -------------
level | [logging-levels](https://github.com/winstonjs/winston#logging-levels)
silent | setting to true will turn the console transport off (default: false)
dispatch | setting to false will disable log shipping (default: true)
client | [api-options](https://github.com/restify/clients#api-options)
basicAuth | [description](https://github.com/restify/clients#basicauthusername-password)
debug | print responses status
prepend | sends the level and message to request (default: { level: true, message: true })

### Meta Options:
Key | Description
------------ | -------------
method | HTTP method (default: post)
options | [description](https://github.com/restify/clients#upgrades)
path | endpoint api (default: '/')
data | object for sending, supported in POST methods, PUT (default: {})

### Example:
This example is [available here as well](./example/server.js).
```javascript
'use strict'

const restify = require('restify')
const winston = require('winston')
const winstonRestify = require('winston-restify')

winston
  // HTTP transport included to winston
  .add(
    winstonRestify, {
      silent: true,
      dispatch: true,
      debug: true,
      client: {
        url: 'http://localhost:8080/logger'
      }
    }
  )
  // remove transport from the logger to terminal
  .remove(winston.transports.Console)

const server = restify.createServer()

server.get('/', function (req, res, next) {
  winston.info('sending_logger', {
    method: 'get',
    path: '/logger'
  })
  res.send(200, { info: 'see your terminal!!' })
  next()
})

server.get('/logger', function (req, res, next) {
  console.log('hello logger!!!!')
  next()
})

server.listen(8080, function () {
  console.log('listening on http://localhost:8080/')
})


```
### Tests
```shell
npm test
```
## License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2018-present

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