core: Log versions of Uppy plugins for debugging (#1640)

* 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
This commit is contained in:
Artur Paikin 2019-06-12 21:04:38 +03:00 committed by GitHub
parent 9731431913
commit 9c2bcc8df8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -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) {

View file

@ -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()