Skip to content

Integration with Ember.Logger? #7

Description

@rmharrison

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

Activity

  1. dfreeman commented on Nov 20, 2017

    @dfreeman
    Member

    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
    };
  2. erichaus commented on Jan 6, 2018

    @erichaus

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions