Class 13 Nodejs Training #Winston Logger | How to Log Error,Info and Warning in #logger

preview_player
Показать описание
See the Upgrade Guide for more information. Bug reports and PRs welcome!

Motivation
winston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs. Each winston logger can have multiple transports (see: Transports) configured at different levels (see: Logging levels). For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file.

winston aims to decouple parts of the logging process to make it more flexible and extensible. Attention is given to supporting flexibility in log formatting (see: Formats) & levels (see: Using custom logging levels), and ensuring those APIs decoupled from the implementation of transport logging (i.e. how the logs are stored / indexed, see: Adding Custom Transports) to the API that they exposed to the programmer.

Quick Start
TL;DR? Check out the quick start example in ./examples/. There are a number of other examples in ./examples/*.js. Don't see an example you think should be there? Submit a pull request to add it!

Usage

const winston = require('winston');

level: 'info',
defaultMeta: { service: 'user-service' },
transports: [
//
//
],
});

//
// If we're not in production then log to the `console` with the format:
//
}));
}
You may also log directly via the default logger exposed by require('winston'), but this merely intended to be a convenient shared logger to use throughout your application if you so choose. Note that the default logger doesn't have any transports by default. You need add transports by yourself, and leaving the default logger without any transports may produce a high memory usage issue.

#webdevelopement
#backendframeworknodejs



#nodejs #mongodb #mongoose #mongodbatlas #cloudcomputing

#nodejs
#experiencedeveloper
#Interview
#node
#software
#engineer
#question
#git
#nodejs
#angularjs
#javascript
#TCS
#CTS
#IBM
#WIPRO
#INFOSYS
#GATEWAY GROUP
#MICROSOFT
#NAGARRO
#ORACLE
#DELL
#CISCO
#MPHASIS
#TREDENCE
#ZEBRA
#REDISYS
#DKATALIS
#HAUSEN
#angularjs
#angular
Please support my channel and don't forget to subscribe and like my videos and channel

Рекомендации по теме