mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-23 09:26:51 -05:00
added plugin status logging
This commit is contained in:
parent
d4d64edaa1
commit
51b7b1dea0
2 changed files with 12 additions and 8 deletions
|
@ -323,7 +323,7 @@ module.exports = Common;
|
|||
*/
|
||||
Common.log = function() {
|
||||
if (console && Common.logLevel > 0 && Common.logLevel <= 3) {
|
||||
console.log.apply(console, [Matter.name + ':'].concat(Array.prototype.slice.call(arguments)));
|
||||
console.log.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -335,7 +335,7 @@ module.exports = Common;
|
|||
*/
|
||||
Common.info = function() {
|
||||
if (console && Common.logLevel > 0 && Common.logLevel <= 2) {
|
||||
console.info.apply(console, [Matter.name + ':'].concat(Array.prototype.slice.call(arguments)));
|
||||
console.info.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -347,7 +347,7 @@ module.exports = Common;
|
|||
*/
|
||||
Common.warn = function() {
|
||||
if (console && Common.logLevel > 0 && Common.logLevel <= 3) {
|
||||
console.warn.apply(console, [Matter.name + ':'].concat(Array.prototype.slice.call(arguments)));
|
||||
console.warn.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -75,9 +75,8 @@ var Common = require('./Common');
|
|||
}
|
||||
|
||||
var dependencies = Plugin.trackDependencies(base),
|
||||
sortedDependencies = Common.topologicalSort(dependencies);
|
||||
|
||||
console.log(dependencies, sortedDependencies);
|
||||
sortedDependencies = Common.topologicalSort(dependencies),
|
||||
status = [];
|
||||
|
||||
for (var i = 0; i < sortedDependencies.length; i += 1) {
|
||||
if (sortedDependencies[i] === base.name) {
|
||||
|
@ -86,22 +85,27 @@ var Common = require('./Common');
|
|||
|
||||
var plugin = Plugin.resolve(sortedDependencies[i]);
|
||||
|
||||
if (!plugin) {
|
||||
status.push('❌ ' + sortedDependencies[i]);
|
||||
}
|
||||
|
||||
if (!plugin || Plugin.isUsed(base, plugin.name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Plugin.isFor(plugin, base)) {
|
||||
Common.log('Plugin.installDependencies: ' + Plugin.toString(plugin) + ' is for ' + plugin.for + ' but installed on ' + Plugin.toString(base) + '.', 'warn');
|
||||
Common.warn('Plugin.installDependencies:', Plugin.toString(plugin), 'is for', plugin.for, 'but installed on', Plugin.toString(base) + '.');
|
||||
}
|
||||
|
||||
if (plugin.install) {
|
||||
plugin.install(base);
|
||||
status.push('✅ ' + Plugin.toString(plugin));
|
||||
}
|
||||
|
||||
base.used.push(plugin.name);
|
||||
}
|
||||
|
||||
console.log(base.used);
|
||||
Common.info('Plugin status:', status.join(', '));
|
||||
};
|
||||
|
||||
Plugin.trackDependencies = function(base, tracked) {
|
||||
|
|
Loading…
Reference in a new issue