While logging, now we can log the additional parameters along with the message and severity level.
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'}) });
Now, along with the message, it will also be able to log the additional parameters (or the meta data)
So, instead of log output:
We will be able to log the meta data as follows:
We can pass any number of additional meta data, it will be able to log it in a stringify fashion
In the printf() function, we can fetch the additional parameters (meta data) inside the 'info' parameter as a Symbol key. It will return as an array, then we can stringify it so as to render to the logs.
13
While logging, now we can log the additional parameters along with the message and severity level. 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'}) });
Now, along with the message, it will also be able to log the additional parameters (or the meta data) So, instead of log output:
We will be able to log the meta data as follows:
We can pass any number of additional meta data, it will be able to log it in a stringify fashion