Skip to content

Instantly share code, notes, and snippets.

@geshan
Created March 10, 2021 22:07
Show Gist options
  • Select an option

  • Save geshan/7d78d136686cc24e691ee36f04a9793a to your computer and use it in GitHub Desktop.

Select an option

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
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