Skip to content

Commit 8fb5b41

Browse files
authored
add winston-transport-vscode to transports docs (#2411)
1 parent a326743 commit 8fb5b41

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/transports.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ there are additional transports written by
5959
* [SQLite3](#sqlite3-transport)
6060
* [SSE with KOA 2](#sse-transport-with-koa-2)
6161
* [Sumo Logic](#sumo-logic-transport)
62+
* [VS Code extension](#vscode-extension)
6263
* [Worker Thread based async Console transport](#worker-thread-based-async-console-transport)
6364
* [Winlog2 Transport](#winlog2-transport)
6465

@@ -832,6 +833,40 @@ Options:
832833
### SSE transport with KOA 2
833834
[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.
834835

836+
### VS Code extension
837+
838+
[winston-transport-vscode][48] is a transport for VS Code extension development.
839+
840+
```js
841+
const vscode = require('vscode');
842+
const winston = require('winston');
843+
const { OutputChannelTransport } = require('winston-transport-vscode');
844+
845+
const outputChannel = vscode.window.createOutputChannel('My extension');
846+
847+
const logger = winston.createLogger({
848+
transports: [new OutputChannelTransport({ outputChannel })],
849+
});
850+
```
851+
852+
The extension includes dedicated log levels and format for using with VS Code's
853+
LogOutputChannel.
854+
855+
```js
856+
const { LogOutputChannelTransport } = require('winston-transport-vscode');
857+
858+
const outputChannel = vscode.window.createOutputChannel('My extension', {
859+
log: true,
860+
});
861+
862+
const logger = winston.createLogger({
863+
levels: LogOutputChannelTransport.config.levels,
864+
format: LogOutputChannelTransport.format(),
865+
transports: [new LogOutputChannelTransport({ outputChannel })],
866+
});
867+
```
868+
869+
835870
### Worker Thread based async Console transport
836871

837872
[winston-console-transport-in-worker][46]
@@ -1015,3 +1050,4 @@ That's why we say it's a logger for just about everything
10151050
[45]: https://github.com/datalust/winston-seq
10161051
[46]: https://github.com/arpad1337/winston-console-transport-in-worker
10171052
[47]: https://github.com/kimnetics/winston-newrelic-agent-transport
1053+
[48]: https://github.com/loderunner/winston-transport-vscode

0 commit comments

Comments
 (0)