Open prashanthr opened 6 years ago
👍 Agreed, it's polluting our logs as well.
I did a little more digging.
The logs are output through a debug function in needle.js
, which in turn prints those logs only if !!process.env.DEBUG
is true. I don't want to turn debug off for the entire application, but I'm not sure how much clearbit themselves relies on these logs.
I will submit a PR to disable logs soon.
PR #38
Cool! In the meantime, we came up with a hack for this in our application. This may help you.
// Backup debug
const DEBUG_BACKUP = process.env.DEBUG
// Temporarily disable DEBUG if you don't want to see clearbit debug logs
if (!process.env.CLEARBIT_DEBUG) {
process.env.DEBUG = ''
}
// Import clearbit package
const clearbit = require('clearbit')(YOUR_API_KEY)
// Import debug pacakge in your module
const debug = require('debug')('MY_MODULE')
// Restore DEBUG to it's original config
process.env.DEBUG = DEBUG_BACKUP
When using clearbit to lookup info, a log is added to the console / stdout with the following signature
Currently there is no way to suppress these logs. I believe the underlying root cause is the way clearbit/needle handles the logs. Since this is a forked version of needle, upgrading the version of needle could solve this issue as the new version of needle uses the debug module. Code Reference:
node_modules/lib/needle.js
line# 25The best possible option is to provide a way for the clearbit-node client to suppress logs and perform the check in the underlying needle module.