singhsanket143 / Flights-Service

38 stars 18 forks source link

Winston library: Implement functionality to include or render additional parameters in the logs #13

Open TusharWatts opened 1 year ago

TusharWatts commented 1 year ago

While logging, include or render the additional parameters (meta data or splat data). Currently, we are not able to render them in the logs. For example,

app.listen(ServerConfig.PORT, () => { console.log('Successfully started the server on PORT : ${ServerConfig.PORT}'); Logger.error('Checking error logging', {msg: 'Something went wrong'}) });

Currently, we are not able to render the additional parameters (msg: 'Something went wrong') to the logs. We are getting the log output as following:

Screenshot 2023-06-05 210804

As we can see, only the message is rendered and not the meta data.

We need to implement the functionality such that we are able to include these meta data in the logs file.