Browse Source

Only log info if debug is true (#2855)

* Only log info if debug is true

* Add option logClientVersion

defaults to true

* Update companion.md

Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Artur Paikin <artur@arturpaikin.com>
Masao Kitamura 3 năm trước cách đây
mục cha
commit
0682223f51

+ 4 - 1
packages/@uppy/companion/src/companion.js

@@ -38,6 +38,7 @@ const defaultOptions = {
     },
   },
   debug: true,
+  logClientVersion: true,
 }
 
 // make the errors available publicly for custom providers
@@ -169,7 +170,9 @@ const getOptionsMiddleware = (options) => {
       buildURL: getURLBuilder(options),
     }
 
-    logger.info(`uppy client version ${req.companion.clientVersion}`, 'companion.client.version')
+    if (options.logClientVersion) {
+      logger.info(`uppy client version ${req.companion.clientVersion}`, 'companion.client.version')
+    }
     next()
   }
 

+ 4 - 1
website/src/docs/companion.md

@@ -287,6 +287,7 @@ See [env.example.sh](https://github.com/transloadit/uppy/blob/master/env.example
   secret: 'mysecret',
   uploadUrls: ['https://myuploadurl.com', 'http://myuploadurl2.com']
   debug: true,
+  logClientVersion: true,
   metrics: false
 }
 ```
@@ -320,7 +321,9 @@ See [env.example.sh](https://github.com/transloadit/uppy/blob/master/env.example
 
 11. **debug(optional)** - A boolean flag to tell Companion whether or not to log useful debug information while running.
 
-12. **metrics(optional)** - A boolean flag to tell Companion whether or not to provide an endpoint `/metrics` with Prometheus metrics.
+12. **logClientVersion(optional)** - A boolean flag to tell Companion whether or not to log its version upon startup.
+
+13. **metrics(optional)** - A boolean flag to tell Companion whether or not to provide an endpoint `/metrics` with Prometheus metrics.
 
 ### Provider Redirect URIs