I am trying to improve the quality of our logs and investigating the possibility of custom logger.
I have found it quite useful, but I would like to know if it is possible to add by default fields included in the msg.
I have found that by modifying the log function at line 157 of the file /@node-red/util/lib/log.js I can add more fields to this trace, however I can not retrieve fields from the running msg object.
I would like the msg.id or other fields to appear in the final trace without the need to send the msg object to the logger.
For example, if in the code I write only node.warn("hello")
That req property also travels inside msg right? couldn't you access to other properties of the msg to leave them traced?
If not, how can the code retrieve that information?
The audit log is a special case. It only gets used by the runtime to log access to the HTTP Admin API. The req property is passed in explicitly in those calls.
Again, this has nothing to do with messages passing through a flow. The fact the argument is called msg is probably a poor choice on my part.