C
C
Coder3212016-12-21 15:52:27
JavaScript
Coder321, 2016-12-21 15:52:27

How to log correctly in node?

The question is how to log correctly in node, that is, I need information about each request, each accepted and given parameter to be displayed in the logs. Are there plugins for this and will it not be an extra load if there are a lot of logs?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2016-12-21
@werty1001

As an option:

var log = fs.createWriteStream( __dirname + '/logs/express.log', {flags: 'a'} );
log.write( 'info' );

S
scrpcc1, 2016-12-21
@scrpcc1

I use Sentry (albeit for exception handling, but you can also keep logs if you keep within the limit). Up to 5000 events per day - free of charge. For me, the pluses were - no need to create structures for storage, the possibility of a free account, you can keep logs on the client.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question