microsoft / microsoft/winget-cli

Allow controlling log level and output type using CLI arguments and environment variables

Open
#4,508 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Feature
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Description of the new feature / enhancement

Issue

As far as I know there is only an option to increase verbosity of log level output via the --verbose argument, but there is not a way to decrease the log level.

The reason decreasing the level is desired is to make the logs more scannable when output in terminals which do not allow ANSI escape sequences to properly render progress indicators.

Advanced Terminal

For example, in an advanced terminal such as Windows Terminal winget could render an indeterminant progress indicator

Input:

winget configuration validate -f .\configurations\settings.dsc.yaml

Output Loop:

\ Retrieving configuration details

Final Output:

Validation found no issues.

This results in a nice compact total of

winget configuration validate -f .\configurations\settings.dsc.yaml
Validation found no issues.

Basic Terminal

I am using winget in a Github Action which is where the issue occurs.
The rotating bar prints many new lines without offering any value to the user. This is wasteful and makes it hard to scan

  winget configuration validate -f .\configurations\settings.dsc.yaml
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"

   - Initializing configuration system

   - Reading configuration file
   - Retrieving configuration details
   \ Retrieving configuration details
   - Retrieving configuration details
   ... <many lines removed>
   - Retrieving configuration details
   \ Retrieving configuration details
   | Retrieving configuration details
   | Retrieving configuration details
   / Retrieving configuration details
   - Retrieving configuration details
   \ Retrieving configuration details
                                                                                                                        
Validation found no issues.

Proposed technical implementation details

Argument Options
  • Add a --log-level argument
  • Add a --no-progress argument
How to make it work by default (use Environment variables)

It is common convention that tools behave differently when the CI=true flag is present.
In other words, when CI=true, winget automatically applies No Progress, or ANSI output

This is enabled or set by default in ADO and Github so developers can use the same commands they are used to locally and they work properly without change in CI.

Could also add support for:

WINGET_LOGLEVEL
WINGET_NO_PROGRESS

Contributor guide

Open the contributing guide

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.

Research direction

No file, test, or entry point is named. Start by tracing the existing --verbose argument and the progress-indicator output, then inspect how environment variables such as CI are handled. Done means supporting the requested log-level and no-progress controls through CLI arguments and documented environment-variable behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.