Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a new Community Transport option to the list: Worker Thread based async Console Transport #2140

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 35 additions & 12 deletions docs/transports.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ There are several [core transports](#built-in-to-winston) included in `winston`
that leverage the built-in networking and file I/O offered by Node.js core. In
addition, there are transports which are [actively supported by winston
contributors](#maintained-by-winston-contributors). And last (but not least)
there are additional transports written by
there are additional transports written by
[members of the community](#community-transports).

> Additionally there are transports previously maintained by winston
> contributors that are [looking for maintainers](#looking-for-maintainers).
> contributors that are [looking for maintainers](#looking-for-maintainers).

* **[Built-in to winston](#built-in-to-winston)**
* [Console](#console-transport)
Expand Down Expand Up @@ -59,6 +59,7 @@ there are additional transports written by
* [SQLite3](#sqlite3-transport)
* [SSE with KOA 2](#sse-transport-with-koa-2)
* [Sumo Logic](#sumo-logic-transport)
* [Worker Thread based async Console transport](#worker-thread-based-async-console-transport)
* [Winlog2 Transport](#winlog2-transport)

* **[Looking for maintainers](#looking-for-maintainers)**
Expand Down Expand Up @@ -147,7 +148,7 @@ The Stream transport takes a few simple options:

## Maintained by winston contributors

Starting with `[email protected]` an effort was made to remove any transport which added additional dependencies to `winston`. At the time there were several transports already in `winston` which will have slowly waned in usage. The
Starting with `[email protected]` an effort was made to remove any transport which added additional dependencies to `winston`. At the time there were several transports already in `winston` which will have slowly waned in usage. The
following transports are **actively maintained by members of the winston Github
organization.**

Expand Down Expand Up @@ -578,9 +579,9 @@ logger.log('info', 'Log from LogDNA Winston', meta);

### Logzio Transport

You can download the logzio transport here : [https://github.com/logzio/winston-logzio](https://github.com/logzio/winston-logzio)
You can download the logzio transport here : [https://github.com/logzio/winston-logzio](https://github.com/logzio/winston-logzio)

*Basic Usage*
*Basic Usage*
```js
const winston = require('winston');
const Logzio = require('winston-logzio');
Expand Down Expand Up @@ -739,7 +740,7 @@ logger.add(new SeqTransport({

* __serverUrl__ - the URL for your Seq server's ingestion
* __apiKey__ - (optional) The Seq API Key to use
* __onError__ - Callback to execute when an error occurs within the transport
* __onError__ - Callback to execute when an error occurs within the transport

### SimpleDB Transport

Expand All @@ -762,7 +763,7 @@ The SimpleDB transport takes the following options. All items marked with an ast
*Metadata:* Logged as a native JSON object to the 'meta' attribute of the item.

### Slack Transport
[winston-slack-webhook-transport][39] is a transport that sends all log messages to the Slack chat service.
[winston-slack-webhook-transport][39] is a transport that sends all log messages to the Slack chat service.

```js
const winston = require('winston');
Expand All @@ -780,7 +781,7 @@ const logger = winston.createLogger({
logger.info('This should now appear on Slack');
```

This transport takes the following options:
This transport takes the following options:

* __webhookUrl__ - Slack incoming webhook URL. This can be from a basic integration or a bot. **REQUIRED**
* __channel__ - Slack channel to post message to.
Expand All @@ -803,7 +804,7 @@ logger.add(new wbs({

// path to the sqlite3 database file on the disk
db: '<name of sqlite3 database file>',

// A list of params to log
params: ['level', 'message']
}));
Expand All @@ -823,7 +824,28 @@ Options:
* __url__: The Sumo Logic HTTP collector URL

### SSE transport with KOA 2
[winston-koa-sse](https://github.com/alexvictoor/winston-koa-sse) is a transport that leverages on Server Sent Event. With this transport you can use your browser console to view your server logs.
[winston-koa-sse](https://github.com/alexvictoor/winston-koa-sse) is a transport that leverages on Server Sent Event. With this transport you can use your browser console to view your server logs.

### Worker Thread based async Console transport

[winston-console-transport-in-worker][46]

```typescript
import * as winston from 'winston';
import { ConsoleTransportInWorker } from '@rpi1337/winston-console-transport-in-worker';

...

export const logger: winston.Logger = winston.createLogger({
format: combine(timestamp(), myFormat),
level: Level.INFO,
transports: [new ConsoleTransportInWorker()],
});
```

The `ConsoleTransportInWorker` is a subclass of `winston.transports.Console` therefore accepting the same options as the `Console` transport.

TypeScript supported.

### Winlog2 Transport

Expand All @@ -843,7 +865,7 @@ The winlog2 transport uses the following options:

## Looking for maintainers

These transports are part of the `winston` Github organization but are
These transports are part of the `winston` Github organization but are
actively seeking new maintainers. Interested in getting involved? Open an
issue on `winston` to get the conversation started!

Expand Down Expand Up @@ -937,7 +959,7 @@ In addition to the options accepted by the [riak-js][12] [client][13], the Riak
## Find more Transports

There are more than 1000 packages on `npm` when [you search for] `winston`.
That's why we say it's a logger for just about everything
That's why we say it's a logger for just about everything

[you search for]: https://www.npmjs.com/search?q=winston
[0]: https://nodejs.org/api/stream.html#stream_class_stream_writable
Expand Down Expand Up @@ -986,3 +1008,4 @@ That's why we say it's a logger for just about everything
[43]: https://www.npmjs.com/package/winston-bigquery
[44]: https://github.com/Quintinity/humio-winston
[45]: https://github.com/datalust/winston-seq
[46]: https://github.com/arpad1337/winston-console-transport-in-worker