Control the logging level in the CLI
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start at main.py and the root atldld CLI command, then trace how commands currently configure or emit logging. Add the proposed verbosity control and verify the documented default, -v, -vv, and excessive-verbosity behaviors using the example CLI commands.
Written by the indexing model from the issue text.
Description
Regarding tracebacks / debugging, there are for sure different options.
First of all, we already have a way because we added the __main__.py file. So now to debug some atldld <command> command one just needs to write python -m pdb -m atldld <command>. (I think one needs at least py37...)
And yes I've seen people using CLI flags to control the debug output. One could add something like --debug, --log-level, -v/-vv/-vvv directly to the root atldld command. For logging it would then configure the logging accordingly:
import logging
logger = logging.getLogger(__name__)
@click.group()
@click.option('-v', '--verbose', count=True)
def root(verbose):
"""Run the command line interface for Atlas-Download-Tools."""
if verbose == 0:
log_level = logging.WARNING
elif verbose == 1:
log_level = logging.INFO
else: # verbose >= 2:
log_level = logging.DEBUG
logging.basicConfig(level=log_level)
if verbose > 2:
logger.warning("The maximal verbosity is -vv")
@root.command("test")
def test():
logger.critical("Critical")
logger.error("Error")
logger.warning("Warning")
logger.info("Info")
logger.debug("Debug")
$ atldld test
CRITICAL:atldld.cli:Critical
ERROR:atldld.cli:Error
WARNING:atldld.cli:Warning
$ atldld -v test
CRITICAL:atldld.cli:Critical
ERROR:atldld.cli:Error
WARNING:atldld.cli:Warning
INFO:atldld.cli:Info
$ atldld -vv test
CRITICAL:atldld.cli:Critical
ERROR:atldld.cli:Error
WARNING:atldld.cli:Warning
INFO:atldld.cli:Info
DEBUG:atldld.cli:Debug
$ atldld -vvv test
WARNING:atldld.cli:The maximal verbosity is -vv
CRITICAL:atldld.cli:Critical
ERROR:atldld.cli:Error
WARNING:atldld.cli:Warning
INFO:atldld.cli:Info
DEBUG:atldld.cli:Debug
Originally posted by @Stannislav in https://github.com/BlueBrain/Atlas-Download-Tools/pull/66#discussion_r698353401
- Dominant language
- Python
- Stars
- 17
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from BlueBrain/Atlas-Download-Tools
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Some RMA queries never return all resultsMay be free again @Stannislav claimed this 1755 days ago, and no pull request is open. Open
BlueBrain/Atlas-Download-Tools#98 · 1 assignee ·
-
Add the "downloads faithful dataset" CLI commandMay be free again @Stannislav claimed this 1791 days ago, and no pull request is open. Open
BlueBrain/Atlas-Download-Tools#95 · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
BlueBrain/Atlas-Download-Tools#93 · 1 reaction ·
All issues in BlueBrain/Atlas-Download-Tools
Similar issues
-
repo-audit
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
scverse/repo-health#20 ·
Maintainers usually reply within 1 day
-
/context/prime scope override double-prefixes an entity-ref project and drops its scoped memoriesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
phasespace-labs/palinode#232 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
collective/icalendar#1858 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
langflow-ai/langflow#15496 ·
Maintainers usually reply within 1 day