Socket
Book a DemoInstallSign in
Socket

winston-this

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston-this

Winston Logger Module

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

winston-this

This is a simple winstone logger module to add on your NodeJS project

Install

npm install winston-this

Usage

Create a log instance

const logger = require('winston-this')();
logger.info('Hello');

// 2017-10-24T12:00:00.000Z - info: Hello - [level:INFO]

Create a log instance with a custom tag to identify it

const logger = require('winston-this')('api');
logger.info('Hello');

// 2017-10-24T12:00:00.000Z - info: Hello - [name:api] [level:INFO]

Tag Usage

You can pass tags to pass more information

logger.info('Hello', { user: 'arielfr' });

// 2017-10-24T12:00:00.000Z - debug: Hello - [name:api] [user:arielfr] [level:DEBUG]

Log Levels

To specify a log level you can use the environmental variable LOG_LEVEL.

PROCESS.env.LOG_LEVEL = 'DEBUG';

The default log level is INFO

License

Copyright 2017

Keywords

winston

FAQs

Package last updated on 24 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts