Accept log level names for --log-level and record CLI argument errors

Open
#20,968 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

The payload names no files, so start by finding where --log-level is parsed and where the LoggingLevel values and the general.loggingLevel names are defined, and make the names match those. Done means names work case-insensitively alongside the numbers, secrets is rejected, and a command line argument error writes usage and the error to %TEMP%\nvda-cli-error.log and stderr while keeping exit code 2. The issue is untriaged and the secrets removal is a breaking change, so wait for a maintainer decision before starting.

Written by the indexing model from the issue text.

Description

p5 triaged
Is your feature request related to a problem? Please describe.

Two related gaps in NVDA's command line handling:

  1. --log-level only accepts numbers (5, 10, 12, 15, 20, 100).
    The names used by general.loggingLevel in the configuration
    (debug_unredacted, debug, io, debugwarning, info, off)
    are rejected, so users must memorize magic numbers. The help text
    additionally names a stale secrets alias that matches nothing in
    the configuration.
  2. When command line arguments are invalid, NVDA (which runs without a
    console) reports the error only in a message dialog. Nothing reaches
    stderr or any file, so failed unattended launches cannot be diagnosed.
Describe the solution you'd like
  • Accept level names case-insensitively for --log-level, in addition
    to the existing numbers. Valid names mirror LoggingLevel:
    debug_unredacted 5, debug 10, io 12, debugwarning 15,
    info 20, off 100. Numbers keep working unchanged.
  • Drop the stale secrets alias so accepted names stay in step with
    the configuration (explicit minor break: --log-level=secrets will
    be rejected).
  • On any command line argument error, write usage plus the error to
    %TEMP%\nvda-cli-error.log and to stderr, name the saved path in
    the dialog, and keep exit code 2.
Describe alternatives you've considered
  • Status quo (numbers only): keeps the confusing mismatch between CLI
    and configuration.
  • Writing the error log to the NVDA log directory instead of %TEMP%:
    rejected, the config path is not resolved at argument-parse time.
Additional context

I plan to implement this and will open a PR once this issue is triaged.

Dominant language
Python
Stars
2.7k
Forks
842
Avg merge
2d 4h
Merged PRs (30d)
56

Getting set up

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 nvaccess/nvda

All issues in nvaccess/nvda

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.