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

Integration with Ember.Logger? #7

Open
rmharrison opened this issue Nov 20, 2017 · 2 comments
Open

Integration with Ember.Logger? #7

rmharrison opened this issue Nov 20, 2017 · 2 comments

Comments

@rmharrison
Copy link

rmharrison commented Nov 20, 2017

Q: How difficult would it be to use Ember.Logger.debug instead of this.debug? Have not overwritten Ember core components before, and was hoping for a bit of guidance within the context of ember-debug-logger, possibly for a PR.

My issue with this.debug is the difficulty of refactoring/adding additional functionality beyond the scope of ember-debug-logger. For example, while console logging is great for now, I know I'll want to injest JSON-formatted log files, either to a 1st-party logging end-point I create or a 3rd-party service (AWS CloudWatch, Airbrake, Rollbar, etc.)

If this.debug were wrapped in Ember.Logger.debug, I could include these additional log streams at Ember.Logger.debug without touching ember-debug-logger.

There is precedent in the community. For example, ember-cli-rollbar rollbar.critical(msg) <--> Ember.Logger.error(msg), see: https://github.com/davewasmer/ember-cli-rollbar/blob/master/app/initializers/rollbar.js#L8

@dfreeman
Copy link
Member

dfreeman commented Nov 20, 2017

The consensus seems to be that Ember.Logger isn't really necessary anymore, since it's basically just a polyfill for console.log. It intentionally didn't get assigned an import path in the new modules API.

The debug library itself supports custom output streams and custom formatters, though, so you could do something like this:

window.debug.log = (...params) => {
  // multiplex to various locations, including Ember.Logger.debug if you like
};

@hoIIer
Copy link

hoIIer commented Jan 6, 2018

@dfreeman how could I set this to this.logger.debug instead of this.debug? otherwise i'd need to update a huge amount of code which isn't ideal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants