Skip to content

Commit

Permalink
Chore: Adding debug logs on successful plugin loads (#10100)
Browse files Browse the repository at this point in the history
* Chore: Adding debug logs on successful plugin loads

* Chore: Adding resolved plugin path to debug logging
  • Loading branch information
platinumazure committed Mar 20, 2018
1 parent a717c5d commit 0360cc2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/config/plugins.js
Expand Up @@ -120,6 +120,26 @@ class Plugins {
throw pluginLoadErr;
}

// This step is costly, so skip if debug is disabled
if (debug.enabled) {
const resolvedPath = require.resolve(longName);

let version = null;

try {
version = require(`${longName}/package.json`).version;
} catch (e) {

// Do nothing
}

const loadedPluginAndVersion = version
? `${longName}@${version}`
: `${longName}, version unknown`;

debug(`Loaded plugin ${pluginName} (${loadedPluginAndVersion}) (from ${resolvedPath})`);
}

this.define(pluginName, plugin);
}
}
Expand Down

0 comments on commit 0360cc2

Please sign in to comment.