1.0.3 • Published 7 years ago

winston-this v1.0.3

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

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

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago