# winstonjs-http-transport

> Custom Transport for https://github.com/winstonjs/winston

Latest version **2.0.0** (published 2018-09-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install winstonjs-http-transport
pnpm add winstonjs-http-transport
yarn add winstonjs-http-transport
bun add winstonjs-http-transport
```

## 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 | 2018-09-25 |
| First published | 2018-09-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Author | Akash Mugu |
| Maintainers | akashmugu |
| Keywords | winston, winstonjs, simple, basic, http, transport |

## Links

- npm: https://www.npmjs.com/package/winstonjs-http-transport
- Repository: https://github.com/akashmugu/winstonjs-http-transport
- Homepage: https://github.com/akashmugu/winstonjs-http-transport#readme
- Issues: https://github.com/akashmugu/winstonjs-http-transport/issues
- npm.io page: https://npm.io/package/winstonjs-http-transport

## Dependencies (3)

- [rxjs](https://npm.io/package/rxjs.md) ^6.3.2
- [axios](https://npm.io/package/axios.md) ^0.18.0
- [winston-transport](https://npm.io/package/winston-transport.md) ^4.2.0

## 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
- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K 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

## Recent versions

- 2.0.0 (latest) — 2018-09-25
- 1.0.0 — 2018-09-14

## README

# winstonjs-http-transport
Custom HTTP Transport for [winston][1]

**NOTE**
This is experimental code. Do not use in production


## Why?
Winston already has a built-in HTTP Transport but it recommends using [winstond][2] as a backend which claims to [support both HTTP and nssocket][3]

If you already have an API endpoint for logging and looking for a really simple HTTP Transport to directly POST the logs there, you might find this usefull

## Usage
``` js
import HTTPTransport from 'winstonjs-http-transport'
// OR
const HTTPTransport = require('winstonjs-http-transport')


logger.add(new HTTPTransport({
    logServer: 'http://your-log-server.com',
    room: 'backend-logs',
    bufferInterval: 1000 // ms
}))
```

This will POST the logs in the following JSON format
``` json
{
    "room": "backend-logs",
    "logs": [
        { "message": "Hello", "level": "info" },
        { "message": "World", "level": "warn" }
    ]
}
```
to the endpoint http://your-log-server.com/logs every 1000 ms (only if there are logs in that window)

If you want to use this module, I encourage you to see the code (it's just 27 lines) before and make any required changes as it is currently not optimized enough

[1]: https://github.com/winstonjs/winston
[2]: https://github.com/winstonjs/winstond
[3]: https://github.com/winstonjs/winstond#backends

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