Logger boilerplate taking advantages of Parcel strengths. Offering powerful features from Winston and Morgan.
Chose a folder and create your log:
$ npx logger-boilerplate
This logger ofers two options: systemLogs
and morganMiddleware
Script:
- Create a directory named utils.
- Copy logger.boiler.js then create logger.hercli.js with sample logging file.
- Install needing packages.
- Ready to launch.
Acting as middleware:
>> app.use(morganMiddleware);
Calling in file:
app.get("/document", async (req, res) => {
const { data, error } = await [API]
if (error) {
systemLogs.error('error to get document: ', error);
res.status(500).json({ error });
} else {
systemLogs.info('data from api', data);
res.status(200).json({ data });
}
})
Nodejs-NPM-NPX