Skip to content

Commit

Permalink
Added deprecation logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mtraynham committed Jan 13, 2015
1 parent 9735741 commit cfbc31e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/base-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,9 +996,9 @@ dc.baseMixin = function (_chart) {
```
**/
_chart.renderlet = function (_) {
_chart.renderlet = dc.logger.deprecate(function (_) {
_chart.on(RENDERLET_KEY + '.' + dc.utils.uniqueId(), _);
};
}, 'chart.renderlet has been deprecated. Please use chart.on("renderlet.<renderletKey>", renderletFunction)');

/**
#### .chartGroup([group])
Expand Down
13 changes: 13 additions & 0 deletions src/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,16 @@ dc.logger.debug = function (msg) {

return dc.logger;
};

dc.logger.deprecate = function (fn, msg) {
// Allow logging of deprecation
var warned = false;
function deprecated() {
if (!warned) {
dc.logger.warn(msg);
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};

0 comments on commit cfbc31e

Please sign in to comment.