Not printing any debug statements

Open
#696 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, node.js
Domain
cli, tooling

Research direction

The runnable entry point is the deleteUserData script shown in the issue; start by checking the debug import and invocation against debug 4.1.1's documented Node usage. Re-run the supplied command with -b and confirm that the debug statement is emitted as expected.

Written by the indexing model from the issue text.

Description

I'm sure i'm doing something wrong, but I have this code and it's not printing any debug statement's

#!/usr/bin/env node

const axios = require('axios')
const program = require('commander')
const debug = require('debug')
const config = require('./config.json')
const getJwt = require('./getJwt.js')
const package = require('./package.json')
const { envs } = require('./util')

program
  .usage('[options]')
  .description('Delete files/data for a specific account')
  .option('-v --version', package.version)
  .option('-e --env <env>', 'Environment to create account for. Options are "dev", "qa", stage", or "prod"')
  .option('-m, --email <required>', 'email')
  .option('-p, --password <required>', 'password')
  .option('-a --all', 'Remove all files and documents')
  .option('-b --debug', 'Enable debug mode')
  .parse(process.argv)

if (program.debug) {
  console.log('in program.debug')
  debug.enable('debug')
}
console.log('debug is enabled =', debug.enabled('debug'))
debug('here') // WHY ISN'T THIS PRINTING?

And here's the output from my command:

$ ./deleteUserData -e dev -m foo@example.com -p myPassword -a -b
in program.debug
debug is enabled = true

I'm using version 4.1.1 of debug

Dominant language
JavaScript
Stars
11.5k
Forks
992
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from debug-js/debug

All issues in debug-js/debug

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.