Skip to content

Commit

Permalink
make debug optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Dec 25, 2017
1 parent e0382f8 commit 78bc3d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
'use strict'

const debug = require('debug')('http')
const debugHeaders = require('debug')('http:headers')
let _debugHeaders
function debugHeaders (...args) {
try {
if (!_debugHeaders) _debugHeaders = require('debug')('http')
_debugHeaders(...args)
} catch (err) {}
}

let _debug
function debug (...args) {
try {
if (!_debug) _debug = require('debug')('http')
_debug(...args)
} catch (err) {}
}

/*
* Object capable of making API calls.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"Sehrope Sarkuni"
],
"dependencies": {
"debug": "^3.1.0",
"is-retry-allowed": "^1.0.0",
"tunnel-agent": "^0.6.0"
},
"devDependencies": {
"ava": "^0.18.0",
"debug": "^3.1.0",
"nock": "^9.1.4",
"nyc": "^11.3.0",
"standard": "^10.0.3"
Expand Down

0 comments on commit 78bc3d3

Please sign in to comment.