winston-vscode

1.0.0 • Public • Published

winston-vscode

winston transport for vscode extentions.

Version Bundle size Downloads

CodeFactor SonarCloud Codacy Scrutinizer

Dependencies Security Build Status Coverage Status

Commit activity FOSSA License Made in Ukraine

🇺🇦 Help Ukraine

I woke up on my 26th birthday at 5 am from the blows of russian missiles. They attacked the city of Kyiv, where I live, as well as the cities in which my family and friends live. Now my country is a war zone.

We fight for democratic values, freedom, for our future! Once again Ukrainians have to stand against evil, terror, against genocide. The outcome of this war will determine what path human history is taking from now on.

💛💙 Help Ukraine! We need your support! There are dozen ways to help us, just do it!

Table of Contents

Motivation

When developing VSCode extensions, it is not straightforward how to organize your logs. This package aims to help you use the winston logger in your VSCode application. It utilizes the OutputChannel API under the hood.

Requirements

Platform Status

To use library you need to have node and npm installed in your machine:

  • node >=10
  • npm >=6

Package is continuously tested on darwin, linux and win32 platforms. All active and maintenance LTS node releases are supported.

Installation

To install the library run the following command

  npm i --save winston-vscode

Usage

The package can be used alongside any other winston transport.

import * as vscode from 'vscode';
import { createLogger } from 'winston';
import VSCTransport from 'winston-vscode';

const transport  = new VSCTransport({
    window : vscode.window,
    name   : 'Fatum'
});

const logger = createLogger({
    level      : 'info',
    transports : [ transport ]
});

logger.log('info', 'Extention activated');

A new container with logs will be added to the VSCode "Output" console.

Screenshot

Configuration

Next options can be configured while transport creation:

  • name - name of a extention, VSCTransport by default;
  • window - (required) vscode window object;

Levels

Visual Studio Code handles the following log levels: 'debug', 'info', 'warn', 'error', and 'trace'. For these log levels, native methods will be used. However, for any other custom log levels, the fallback "appendLine" method will be used.

Implementations

Are you looking for more examples?

Validation

Contribute

Make the changes to the code and tests. Then commit to your branch. Be sure to follow the commit message conventions. Read Contributing Guidelines for details.

Readme

Keywords

none

Package Sidebar

Install

npm i winston-vscode

Weekly Downloads

28

Version

1.0.0

License

MIT

Unpacked Size

40.4 kB

Total Files

6

Last publish

Collaborators

  • pustovit