I have some important console logs for some strings and objects on a NodeJs server for each API request.
Already we move a copy of these logs to log files.
Does the console log for these objects will increase the memory usage for each request as they kept in the console , for example if we have 1 million request.
For example
console.log('some data here', new Date())
Yes
console.log
invokes util.formatWithOptions
internally. The formatted string goes to the output stream (stdout, stderr for example).
During the formatting, some variables are created.
The formatted string is a new variable that is referenced until the process write it to the file descriptor.
So, yes for every console.log
call, some variables are created. The memory increase depends what and how many times your code logs.