Ember.Logger is a robust type of logging in Ember. It goes beyond the capabilities of imports.console
. In this recipe, we'll take a look at some examples on how to work with it in your application.
In this project, we'll create a simple program that demonstrates how to use some of the Ember.logging
capabilities:
In a new program, add a new
index
route:$ ember g route index
This will create a new
index
route.Edit the
index.js
file in theroutes
folder. Add some new logging:// app/routes/index.js import Ember from 'ember'; const {Logger}= Ember; export default Ember.Route.extend({ model(){ Logger.log('log'); Logger.info('info', 'more stuff'); Logger.error('error'); Logger.debug('debug'); Logger.warn('warn'); Logger.assert(true === false); return {}; } });
Ember.logging
gives us five different logging options. All these different types oflog
methods accept one or more arguments. Each argument will be joined together...