Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a logging mechanism #102

Closed
fabiodrg opened this issue Mar 16, 2022 · 0 comments · Fixed by #103
Closed

Add a logging mechanism #102

fabiodrg opened this issue Mar 16, 2022 · 0 comments · Fixed by #103
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@fabiodrg
Copy link
Collaborator

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.

@fabiodrg fabiodrg added enhancement New feature or request good first issue Good for newcomers labels Mar 16, 2022
@fabiodrg fabiodrg self-assigned this Mar 16, 2022
@fabiodrg fabiodrg mentioned this issue Mar 16, 2022
fabiodrg added a commit that referenced this issue Mar 16, 2022
It allows to change JS/HTML/... files depending on environment
variables. It is similar to macros in C where you can inject code if
some environment variables are set. Docs: https://www.npmjs.com/package/gulp-preprocess

The preprocess will be used to enabled/disable a the logger according to
the development and production modes. See #102
fabiodrg added a commit that referenced this issue Mar 16, 2022
* chore: Add 'preprocess' in gulp

It allows to change JS/HTML/... files depending on environment
variables. It is similar to macros in C where you can inject code if
some environment variables are set. Docs: https://www.npmjs.com/package/gulp-preprocess

The preprocess will be used to enabled/disable a the logger according to
the development and production modes. See #102

* feat(logger): Add a toggling logger mechanism for dev/prod environments
@fabiodrg fabiodrg added this to Done in v4.2 Mar 28, 2022
@fabiodrg fabiodrg removed this from Done in v4.2 Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant