[Feature Request] Turn on DEBUG log for all commands
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
## Context
There could be a method to turn on DEBUG log for all commands, like turning on DEBUG log for all PowerShell cmdlets through
```ps
$DebugPreference = "Continue"
```
Currently, CLI can enable log file with `logging.enable_log_file` (https://docs.microsoft.com/en-us/cli/azure/azure-cli-configuration) which prints all levels of logs.
## Proposals
### Add `core.debug` config option
A config option `core.debug` can be added, like `core.only_show_error`. However, there will still be no option to always show INFO logs.
### Add `core.log_level` config option and `--log-level` argument
Like `log_cli_level` from `pytest` (https://docs.pytest.org/en/6.2.x/logging.html#live-logs), a more general solution is to add `core.log_level` config option and `--log-level` argument which can be set to
- `debug`
- `info`
- `warning`
- `error`
This is a superset of
- `core.only_show_errors`/`--only-show-errors` (https://github.com/microsoft/knack/pull/179), which is equivalent to `core.log_level=error`/`--log-level error`
- `--debug`, which is equivalent to `core.log_level=debug`/`--log-level debug`
- `--verbose`, which is equivalent to `core.log_level=info`/`--log-level info`
## References
- Teams post: https://teams.microsoft.com/l/message/19:31160a5ec7e24ba0b9d58a5e812c43dd@thread.tacv2/1634322127295?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=9a661795-1b01-4a5b-9dd5-be571422334c&parentMessageId=1634322127295&teamName=Azure%20CLIs%20partners&channelName=Azure%20CLI&createdTime=1634322127295
Contributor guide
Assessment
This issue has not been assessed yet.