No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
addon
app
config
tests
vendor
.bowerrc
.editorconfig
.ember-cli
.eslintignore
.eslintrc.js
.gitignore
.npmignore
.template-lintrc.js
.travis.yml
.watchmanconfig
LICENSE.md
README.md
ember-cli-build.js
index.js
package.json
testem.js
tsconfig.json
tslint.json
yarn.lock

README.md

ember-debug-logger Build Status

ember-debug-logger exposes the visionmedia/debug library for use in your Ember.js application.

Installation

ember install ember-debug-logger

Usage

The debug library is available for standard use by import:

import debug from 'debug';

const log = debug('demo-namespace');

log('Hello, world');

image

Enabling Namespaces During Debugging

During development, you can enable logging for particular namespaces calling debug.enable in the developer console. Your preferences will be persisted in local storage, but they're only checked when a logger is instantiated, so in most cases you'll need to refresh the page to see them take effect.

Enabled namespaces follow simple globbing rules, so to enable logging for everything, you could use:

debug.enable('*');

To enable only logging coming from the application route:

debug.enable('route:application');

You can mix and match as well. To enable logging for all routes and the foo-bar service, for instance:

debug.enable('route:*, service:foo-bar');

You can turn off all logging with disable:

debug.disable();

Namespaces will automatically be differentiated by color, and the time between messages will be logged.

image

Automatic Namespacing

This addon exports a debugLogger function you can attach to a class definition. The resulting method will automatically use its instance's container key as the namespace.

// app/routes/index.js
import Route from '@ember/route';
import debugLogger from 'ember-debug-logger';

export default Route.extend({
  debug: debugLogger();

  activate() {
    this.debug('Hello from the application index.');
  }
});

image