Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 99c208e

Browse files
Add logging only when is set
1 parent c8b6543 commit 99c208e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/request-api.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,17 @@ function requestAPI (path, args, opts, files, buffer, cb) {
9393
var url = config.host + ':' + config.port + reqPath
9494

9595
var req = request(method, url)
96-
.use(logger)
9796
.set('User-Agent', config['user-agent'])
9897
.query(opts)
9998
.buffer(buffer)
10099
.parse(safeJSONParser.bind(null, buffer))
101100
.on('error', cb)
102101
.on('response', handle)
103102

103+
if (process.env.DEBUG) {
104+
req.use(logger)
105+
}
106+
104107
if (files) {
105108
prepareFiles(files).forEach(function (file) {
106109
req.attach('file', file.contents, file.opts)

0 commit comments

Comments
 (0)