Not logging errors properly
There is a bug in the error logging in @mwni/log. When calling log.error(), the error message appears blank in the console, even though log.info() outputs messages correctly.
the issue comes from how the output function spreads the contents array rather than joining it into a single string.
In the output.js std function, I made the following change to make it work for me:
- func(
${prefix}${date} ${level} [\x1b[${colors[color]}${name}\x1b[0m], ...contents)
- func(
${prefix}${date} ${level} [\x1b[${colors[color]}${name}\x1b[0m] ${contents.join(' ')})
Interesting. The array of strings usually gets passed to console.log or console.error. This normally prints everything, and it additionally adds colorized formatting based on types, which is why I decided to not join everything into a string.
What runtime (node/bun/deno) are you using and have you made any changes to the code?
I'm using node v20.18.3 on ubuntu 22.04.
It makes sense that console.error should work like console.log but it doesn't for me.
I haven't made any other changes.
What does node -e "console.error('test', 'one', 2)" print on your system?
test one 2 with the 2 in yellow
Then the problem is not the logging itself but more likely the transit of error messages between forked node processes. I remember there being this issue on some edge cases. Can you tell me which module is emitting errors?
That makes sense, I will check when I'm at my desk tonight, I also DMed you on X with a development request. Thanks.