summaryrefslogtreecommitdiffstats
path: root/lib/plugin.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-01-26 12:42:01 +0100
committerSamy Pessé <samypesse@gmail.com>2015-01-26 12:42:01 +0100
commita53ec62e4a169d62b28c0f993e2df23b5d269a17 (patch)
tree796d13e5d5f01b0efa8d9bebc3fa5548deb4e60f /lib/plugin.js
parent795da31af81c1dd8740a9129dc0eb959b9852ee8 (diff)
downloadgitbook-a53ec62e4a169d62b28c0f993e2df23b5d269a17.zip
gitbook-a53ec62e4a169d62b28c0f993e2df23b5d269a17.tar.gz
gitbook-a53ec62e4a169d62b28c0f993e2df23b5d269a17.tar.bz2
Fix logs for deprecated hooks
Diffstat (limited to 'lib/plugin.js')
-rw-r--r--lib/plugin.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/plugin.js b/lib/plugin.js
index 3d60321..bcc861d 100644
--- a/lib/plugin.js
+++ b/lib/plugin.js
@@ -114,6 +114,7 @@ Plugin.prototype.isValid = function() {
// Valid hooks
_.each(this.infos.hooks, function(hook, hookName) {
+ if (_.contains(Plugin.HOOKS, hookName)) return;
that.book.log.warn.ln("Hook '"+hookName+" 'used by plugin '"+that.packageInfos.name+"' has been removed or is deprecated");
});
@@ -135,6 +136,9 @@ Plugin.prototype.callHook = function(name, data) {
if (!hookFunc) return Q(data);
+ this.book.log.debug.ln("call hook", name);
+ if (!_.contains(Plugin.HOOKS, name)) this.book.log.warn.ln("hook '"+name+"' used by plugin '"+this.name+"' is deprecated, and will be remove in the coming versions");
+
return Q()
.then(function() {
return hookFunc.apply(context, [data]);