Any reason to use `logging` rather than `Console` ...
# development
f
logging
would be more appropriate for debug/trace logs which would normally never be a part of a goalโ€™s expected output.
for example, consider a goal like
dependees
which outputs data about the project for the user. the console is used to dump that data while
logging
would be used to emit info/debug/trace logs, none of which are that data.
c
Ah, right. Thanks, makes sense ๐Ÿ™‚
๐Ÿ‘ 1
h
I think only
goal_rules
can write to the Console ?
For that reason
h
Yeah. But even in some goal_rules, we still log things like "Wrote package to dist/..". We used to print to console, but changed The way I personally view it is to use Console when the output is the main thing the user is after, like
./pants fmt
or
./pants dependees
. Use logging when output is more of a side effect to explain the main thing, like "FYI we built this package and wrote it here"
h
Yeah, Console is for where the output is the goal, and say you might want to pipe to another tool.
โž• 1
๐Ÿ‘ 1
c
perfect. these kind of design decisions could perhaps be added to https://www.pantsbuild.org/docs/internal-rules-architecture or similar page.. ? ๐Ÿ™‚
h
Probably even better is https://www.pantsbuild.org/docs/rules-api-logging or https://www.pantsbuild.org/docs/rules-api-goal-rules#console-output-to-stdoutstderr (realized I never finished writing the first page ๐Ÿ‘€)
๐Ÿ‘ 1
c
Right. thereโ€™s a lot of info in there, that need to re-visit. Would love to know more about streaming results, as was mentioned on that first page.. ๐Ÿ™‚ also the effect of specifying
level
on your
@rule
decorator.. (maybe it is in there already..)
h
Yeah it's in part not finished because we're collectively not fully happy with the status quo With the Plugin API, I was doing "docs-driven development", where writing the docs made it clear what parts of the API were confusing/clunky etc, and then I'd fix the API as a result. I didn't have time to do that with dynamic UI yet ๐Ÿคทโ€โ™‚๏ธ
๐Ÿ’ฏ 1