I am looking at the file context write sequence to try to see if I can see any improvements to reduce the likelihood of corruption triggered by power fail. How can I enable the trace logging in node-red/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/util.js at master · node-red/node-red · GitHub? I tried setting the log level to trace in settings.js and lots of extra stuff came out, but not the util.js logs.
I don't know the answer. But have you tried using the inspector nodes? That lets you track what is happening in your browser dev tools.
Thanks. I don't really need that complexity. I just want to understand what it is doing. The existing optional logging would do, at least initially, if I could just switch it on.
The code uses
const log = require("@node-red/util").log;
Then logs using log.trace()
, but setting log level to trace in settings.js does not enable it.
The normal approach for custom nodes is to use RED.log.trace()
of course. Hard to track whether the direct require of the util log is the same thing. I assumed it was.
Personally, I find that, unless you set up a custom logger, the amount of data from a working system when logs are turned up to trace level is unusable.
Instead, I put a breakpoint in the area of code I'm interested in and then can step through and see the data passing through as well.