Przeglądaj źródła

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
Artur Paikin 5 lat temu
rodzic
commit
9c2bcc8df8

+ 1 - 1
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) {

+ 6 - 0
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()