Skip to content

Add --log global flag as alias for --verbose/-v #2258

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Aug 3, 2023

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

Adds a --log global flag and hides the old -v.
This change allows to print logs with commands that have their own -v flag overridden (compile and upload).

What is the current behavior?

$ arduino-cli
[...]
      --log-file string           Path to the file where logs will be written.
      --log-format string         The output format for the logs, can be: text, json
      --log-level string          Messages with this level and above will be logged. Valid levels are: trace, debug, info, warn, error, fatal, panic
      --no-color                  Disable colored output.
  -v, --verbose                   Print the logs on the standard output.

$ arduino-cli compile -b arduino:avr:uno -v
[...there is no way to display log with compile command...]

$ arduino-cli upload -b arduino:avr:uno -p /dev/ttyACM0 -v
[...there is no way to display log with upload command...]

What is the new behavior?

$ arduino-cli
[...]
      --log                       Print the logs on the standard output.
      --log-file string           Path to the file where logs will be written.
      --log-format string         The output format for the logs, can be: text, json
      --log-level string          Messages with this level and above will be logged. Valid levels are: trace, debug, info, warn, error, fatal, panic
      --no-color                  Disable colored output.

Use "arduino-cli [command] --help" for more information about a command.

$ arduino-cli compile -b arduino:avr:uno -v --log
[...run verbose compile and print logs together...]

$ arduino-cli upload -b arduino:avr:uno -p /dev/ttyACM0 -v
[...run verbose upload and print logs together...]

Does this PR introduce a breaking change, and is titled accordingly?

The old -v flag is not removed but just hidden, everything will continue to work as before.

Other information

@cmaglie cmaglie added type: enhancement Proposed improvement topic: CLI Related to the command line interface labels Aug 3, 2023
@cmaglie cmaglie self-assigned this Aug 3, 2023
@codecov
Copy link

codecov bot commented Aug 4, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: -0.03% ⚠️

Comparison is base (b678f6f) 62.97% compared to head (53645d3) 62.94%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2258      +/-   ##
==========================================
- Coverage   62.97%   62.94%   -0.03%     
==========================================
  Files         220      220              
  Lines       19501    19523      +22     
==========================================
+ Hits        12280    12288       +8     
- Misses       6137     6147      +10     
- Partials     1084     1088       +4     
Flag Coverage Δ
unit 62.94% <50.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
arduino/cores/packagemanager/package_manager.go 76.61% <0.00%> (-0.44%) ⬇️
arduino/resources/index.go 46.29% <33.33%> (-2.73%) ⬇️
commands/instances.go 64.43% <64.28%> (-0.27%) ⬇️
internal/cli/cli.go 87.26% <100.00%> (+0.16%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cmaglie cmaglie merged commit 246adf9 into arduino:master Aug 4, 2023
@cmaglie cmaglie deleted the logs branch August 4, 2023 14:09
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
topic: CLI Related to the command line interface type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants