How can I make log4js print objects like console.log
I have a project with JavaScript in 2 locations. One is using node.js on the server side and the other is obviously a JavaScript browser. I have to support any browser and I would like to have a single logging framework for all of them. I chose log4js, which works great for writing strings, but for objects, it's a little difficult.
In node, when I do Logger.debug(someObject);
, I get a nice printout of the object. When I try to do this with my JavaScript browser, I get [object Object], which is useless.
Does anyone know how to do this?
(node ββuses terminal as output console, and browser JavaScript uses browser console (Chrome))
+3
source to share