You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
importlogginglogger=logging.getLogger(__name__)
@click.group()@click.option('-v', '--verbose', count=True)defroot(verbose):
"""Run the command line interface for Atlas-Download-Tools."""ifverbose==0:
log_level=logging.WARNINGelifverbose==1:
log_level=logging.INFOelse: # verbose >= 2:log_level=logging.DEBUGlogging.basicConfig(level=log_level)
ifverbose>2:
logger.warning("The maximal verbosity is -vv")
@root.command("test")deftest():
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
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 someatldld <command>
command one just needs to writepython -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 rootatldld
command. For logging it would then configure the logging accordingly:$ 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 #66 (comment)
The text was updated successfully, but these errors were encountered: