Home > Net >  bazel logging inside of a BUILD file
bazel logging inside of a BUILD file

Time:09-25

Hi I want to see what is being passed to a rule that is defined in a rules.bzl file. So I would like to add just a logging statement inside of either the BUILD file or the rules.bzl file just to see what parameter was passed. I realize there is a whole --execution_log_binary_file and there is a good deal of stuff to read up on, but I am definitely looking to do something just once and quick and dirty. Do I import logging module? Is it something else? Thanks

CodePudding user response:

Use the builtin Starlark print() function in BUILD or .bzl files to dump values Bazel's console.

CodePudding user response:

bazel query --output=build //my/package:all will print out the definitions of all the targets created by macros called from my/package/BUILD by any .bzl file. This includes all the attributes passed to to various rules to create those targets.

  • Related