Created
March 10, 2021 22:07
-
-
Save geshan/6a553f7d6be1dbd3e464ff36f57726b1 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 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('loglevel'); | |
const port = 3004; | |
//more docs here - https://github.com/pimterry/loglevel#documentation | |
app.get('/', (req, res) => { | |
res.send('Hello World! - loglevel logged'); | |
}); | |
app.get('/api/test', (req, res) => { | |
logger.warn('Loglevel is simple'); | |
res.json({'message': 'Hello loglevel!'}); | |
}); | |
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