gadicc / node-yahoo-finance2

Unofficial API for Yahoo Finance
https://www.npmjs.com/package/yahoo-finance2
MIT License
353 stars 58 forks source link

Improve logging / debugging (umbrella issue) #783

Open gadicc opened 1 week ago

gadicc commented 1 week ago

I'm aware of a lot of mildly annoying console output when using the library, we've simply been focusing on bigger issues (predominantly: keeping the library working amongst frequent changes on Yahoo's ends, or bigger restructurings that can help make the library more manageable, like validation and testing).

Also, of course, logging is entirely user configurable, see docs/other/setGlobalConfig.md#logger. But it would be nice to have good defaults out of the box.

So, once we get to this (and feel free to subscribe to this issue for when we do), the guiding principles should be:

  1. Don't show anything by default
  2. "Conditional logging"... store some stuff in a buffer and only show it if there's an error.
  3. On errors, ALWAYS give the library version, as old versions / npm issues are some of the most common problems.
  4. Think sensibly about the different debug levels and how to control them.

Those cover what I've had in mind for a while, anyone feel free to chime in with further ideas.