wordpress-playground icon indicating copy to clipboard operation
wordpress-playground copied to clipboard

Logging levels

Open adamziel opened this issue 3 years ago • 1 comments

The amount of log messages is too large and reduces the usefulness of the logged information. Let's find a solution that supports:

  • Different logging level (at least debug, info, warn, error)
  • Custom module labels (like PHP, ServiceWorker, etc.)
  • Filtering the output by level and module

adamziel avatar Oct 22 '22 04:10 adamziel

There's an NPM library called debug that's popular.

debug - A tiny JavaScript debugging utility modelled after Node.js core's debugging technique. Works in Node.js and web browsers

https://github.com/debug-js/debug

Maybe has too many features, like assigning unique color to each namespace.


Another NPM library is called log. It's more minimal, and has logging levels as you described.

log - Universal logging utility

https://github.com/medikoo/log

eliot-akira avatar Oct 22 '22 05:10 eliot-akira

This was a super annoying issue when I was initially working on the service worker, but I never had that problem ever since. The default console levels like warn() or debug() seem to be good enough. If this is ever a problem, let's reopen this issue.

adamziel avatar Jun 02 '23 14:06 adamziel