From 9c2bcc8df86030cac70e6e4d750fa207058e80ff Mon Sep 17 00:00:00 2001 From: Artur Paikin Date: Wed, 12 Jun 2019 21:04:38 +0300 Subject: [PATCH] core: Log versions of Uppy plugins for debugging (#1640) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Log Core’s version in constructor, log each plugin’s version in .use() * Check that Plugin.VERSION exists before logging it * Log which DOM element we are mounting to --- packages/@uppy/core/src/Plugin.js | 2 +- packages/@uppy/core/src/index.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/@uppy/core/src/Plugin.js b/packages/@uppy/core/src/Plugin.js index 5c894965c..6875e3efa 100644 --- a/packages/@uppy/core/src/Plugin.js +++ b/packages/@uppy/core/src/Plugin.js @@ -114,7 +114,7 @@ module.exports = class Plugin { } this._updateUI = debounce(this.rerender) - this.uppy.log(`Installing ${callerPluginName} to a DOM element`) + this.uppy.log(`Installing ${callerPluginName} to a DOM element '${target}'`) // clear everything inside the target container if (this.opts.replaceTargetContent) { diff --git a/packages/@uppy/core/src/index.js b/packages/@uppy/core/src/index.js index 54cee56eb..9c26c2adb 100644 --- a/packages/@uppy/core/src/index.js +++ b/packages/@uppy/core/src/index.js @@ -83,6 +83,8 @@ class Uppy { this.opts = Object.assign({}, defaultOptions, opts) this.opts.restrictions = Object.assign({}, defaultOptions.restrictions, this.opts.restrictions) + this.log(`Using Core v${this.constructor.VERSION}`) + // i18n this.translator = new Translator([ this.defaultLocale, this.opts.locale ]) this.locale = this.translator.locale @@ -910,6 +912,10 @@ class Uppy { throw new Error(msg) } + if (Plugin.VERSION) { + this.log(`Using ${pluginId} v${Plugin.VERSION}`) + } + this.plugins[plugin.type].push(plugin) plugin.install()