3 ms·
Yeah, NodeJS is indeed lacking some proper introspection functionality :( What I'm doing to get the call stack really is nothing but an ugly hack. And users of
by epegzz 6y ago
Yeah, NodeJS is indeed lacking some proper introspection functionality :(
What I'm doing to get the call stack really is nothing but an ugly hack. And users of this logger even have to do the annoying `log = init(log)` dance to make the hack work. Because if I had put the hack inside the formatter directly I would not have been able to get the actual calling location from the stack trace, as NodeJS is limiting the stack trace length to 10 entries by default, which in this case would be too short.
So the strong arguments for JS really aren't its language design and features but rather the fact it can be used universally in backend, frontend and mobile (i.e. allows for code sharing, less context switching during development if you're "fullstack"). Wish there were more languages that would easily support that :)