msramalho / SigTools

📆 Sigarra Tools | An extension that makes the information system of the University of Porto slightly better.
https://chrome.google.com/webstore/detail/sigarra-to-calendar/piefgbacnljenipiifjopkfifeljjkme
Apache License 2.0
37 stars 0 forks source link

Add a logging mechanism #102

Closed fabiodrg closed 2 years ago

fabiodrg commented 2 years ago

I don't think there is a need for a fancy logger, but would be nice to have console.log, console.debug, ... in the code, but just print something on development mode. Since this is an extension, messing with the global console object does not seem the right approach. Perhaps we can add a wrapper class:

class Logger {
  static isEnabled = true; // or false on production
  static debug(...) {
    Logger.isEnabled && console.debug(...);
  }
}

With Gulp, and depending on the context, we should be able to enabled or disable the logging.