[PYTHON] Debug output of chalice command

Looking at the chalice command, I see that there are debug options, but

$ chalice --help
Usage: chalice [OPTIONS] COMMAND [ARGS]...

Options:
  --version             Show the version and exit.
  --project-dir TEXT    The project directory path (absolute or
                        relative).Defaults to CWD

  --debug / --no-debug  Print debug logs to stderr.
  --help                Show this message and exit.

Commands:
  delete
  deploy
  dev                Development and debugging commands for chalice.
  gen-policy
  generate-models    Generate a model from Chalice routes.
  generate-pipeline  Generate a cloudformation template for a starter CD...
  generate-sdk
  invoke             Invoke the deployed lambda function NAME.
  local
  logs
  new-project
  package
  url

If you do the following, you will get angry ...

Get angry


$ chalice package build --debug
Usage: chalice package [OPTIONS] OUT
Try 'chalice package --help' for help.

Error: no such option: --debug

Apparently, if you want to pass an option, you need to pass it before the subcommand.

Or rather, if you look closely at the first one, it will be chalice [OPTIONS] COMMAND [ARGS], and --debug is a list of ʻOPTIONS`, so you have to set it here ...

This is OK


$ chalice --debug package build
2020-05-04 19:16:44,435 botocore.hooks [DEBUG] Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2020-05-04 19:16:44,440 botocore.hooks [DEBUG] Changing event name from before-call.apigateway to before-call.api-gateway
2020-05-04 19:16:44,441 botocore.hooks [DEBUG] Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2020-05-04 19:16:44,443 botocore.hooks [DEBUG] Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2020-05-04 19:16:44,443 botocore.hooks [DEBUG] Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2020-05-04 19:16:44,444 botocore.hooks [DEBUG] Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
(Omission)

I was told that I didn't notice that the options were clearly separated because I sometimes passed an argument starting with -- to ʻARGS, like chalice package --stage local`.

Recommended Posts

Debug output of chalice command
Basics of python: Output
Gradually display the output of the command executed by subprocess.Popen
Get the output value of the command (as received by xargs)
Filter the output of tracemalloc
About HOG output of Scikit-Image
How to output the output result of the Linux man command to a file
Completion of docker command on Linux
Have python read the command output
[Django] Command to output QuerySet to csv
Summary of "nl command Advent Calendar 2020"