Function

Module: @ember/debug

Available since v1.0.0

import { warn } from '@ember/debug';
message
String
A warning to display.
test
Boolean
An optional boolean. If falsy, the warning will be displayed.
options
Object
An object that can be used to pass a unique `id` for this warning. The `id` can be used by Ember debugging tools to change the behavior (raise, log, or silence) for that specific warning. The `id` should be namespaced by dots, e.g. "ember-debug.feature-flag-with-features-stripped"

Display a warning with the provided message.

  • In a production build, this method is defined as an empty function (NOP). Uses of this method in Ember itself are stripped from the ember.prod.js build.
1
2
3
4
5
6
7
import { warn } from '@ember/debug';
import tomsterCount from './tomster-counter'; // a module in my project

// Log a warning if we have more than 3 tomsters
warn('Too many tomsters!', tomsterCount <= 3, {
  id: 'ember-debug.too-many-tomsters'
});