diff --git a/src/editor/config/config.js b/src/editor/config/config.js index f5b446edc..9c86d7418 100644 --- a/src/editor/config/config.js +++ b/src/editor/config/config.js @@ -30,6 +30,11 @@ module.exports = { // Width for the editor container width: '100%', + // Type of logs to print with the logger (by default is used the devtool console). + // Available by default: debug, info, warning, error + // You can use `false` to disable all of them or `true` to print all of them + log: ['warning', 'error'], + // By default Grapes injects base CSS into the canvas. For example, it sets body margin to 0 // and sets a default background color of white. This CSS is desired in most cases. // use this property if you wish to overwrite the base CSS to your own CSS. This is most diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index 945b4fc7f..31a61390a 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -60,6 +60,7 @@ module.exports = Backbone.Model.extend({ this.set('toLoad', []); this.set('storables', []); const el = c.el; + const log = c.log; if (el && c.fromElement) this.config.components = el.innerHTML; this.attrsOrig = el @@ -74,6 +75,13 @@ module.exports = Backbone.Model.extend({ this.on('change:componentHovered', this.componentHovered, this); this.on('change:changesCount', this.updateChanges, this); + if (log === true) { + this.listenTo(this, 'log:debug', console.log); + this.listenTo(this, 'log:info', console.info); + this.listenTo(this, 'log:warning', console.warn); + this.listenTo(this, 'log:error', console.error); + } + // Deprecations [{ from: 'change:selectedComponent', to: 'component:toggled' }].forEach( event => {