Created
March 10, 2021 22:07
-
-
Save geshan/7d78d136686cc24e691ee36f04a9793a to your computer and use it in GitHub Desktop.
Markdium-5 Node.js Logging libraries compared for you to make the optimal choice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const app = express(); | |
| const logger = require('npmlog'); | |
| const port = 3005; | |
| //more docs here - https://github.com/npm/npmlog#basic-usage | |
| app.get('/', (req, res) => { | |
| res.send('Hello World! - npmlog logged'); | |
| }); | |
| app.get('/api/test', (req, res) => { | |
| logger.warn('From Npmlog', 'Npmlog is simple too %j', {'message': 'test'}); | |
| res.json({'message': 'Hello npmlog!'}); | |
| }); | |
| app.listen(port, () => { | |
| console.log(`Example app listening at http://localhost:${port}`); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment