Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Adding debug logs on successful plugin loads #10100

Merged
merged 2 commits into from Mar 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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