turbo icon indicating copy to clipboard operation
turbo copied to clipboard

Add `--grouped` flag to group log output

Open jaredpalmer opened this issue 3 years ago • 4 comments

Describe the feature you'd like to request

Output of steps are intermingled and can be a little hard to read

CleanShot 2021-12-12 at 18 03 32@2x

https://twitter.com/yangshunz/status/1470019087669489665

Describe the solution you'd like

  • [ ] Add a --grouped flag that will not stream, but buffer and print all logs of a task once in a single group after a task is completed. This should be the default log behavior in non-interactive terminal processes. Our logstreamer abstraction already has an option for this, but need to make sure that prints to stdout/stderr are not intermingled. Ideally, writes should print First In, First Out, so a (new) queue/channel might be needed inside of run_state.go.
  • [ ] Update documentation

Describe alternatives you've considered

  • --buffered flag name

jaredpalmer avatar Dec 12 '21 23:12 jaredpalmer

Could this be enabled selectively?

For example, I may wish to only group the build tasks but stream the dev ones? That way if dev depends on build, it will initially group the build logs but then switch to streaming for the dev tasks.

marklawlor avatar Dec 17 '21 09:12 marklawlor

@jaredpalmer is this taken up? If not I'd love to take this up. Any guidance would be awesome

satya-nutella avatar Dec 25 '21 04:12 satya-nutella

Would love this. Our CI log is almost useless.

szk2s avatar May 06 '22 08:05 szk2s

+1 could really use this for test output

georeith avatar May 27 '22 19:05 georeith

I'll try check this on the weekend

rubiagatra avatar Dec 13 '22 12:12 rubiagatra

We have the same problem in a bigger project (turbo.json n around 300 lines and 25 package.json in the mono repo). It's always a bit hard to find something in the log :-)

This feature would be really helpful for us ❤️

ruettenm avatar Feb 17 '23 20:02 ruettenm

It also would be cool, if in that case, an additional parameter would toggle turbo to output GitHub Workflow Group statements for every task.

::group::{project name}:{task name}
::endgroup::

(see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines)

Alternatively, turbo could check if it's run in a GitHub Workflow via existence of GITHUB_ environment variables and do the grouping by default.

robaca avatar Feb 18 '23 09:02 robaca

Couple naming options that have been floated internally:

  • --log-stream: natural | grouped
  • --log-order: stream | grouped

The --log-* prefix feels like a good fit after --log-prefix lands.

(cc @rafaeltab if you're interested in picking this up, let me know and I can help you get it merged. You can pick either of the names and we can change it once we get consensus here / internally)

@robaca, we're interested in handling the Github log grouping you mentioned after prefixing and grouping options land independently. The idea would be to compose both to make it Just Work in Github.

mehulkar avatar Feb 21 '23 07:02 mehulkar

How can i contribute to this issue I am just a begineer?

DivvSaxena avatar Mar 30 '23 16:03 DivvSaxena

@DivvSaxena Hey! I am working on this issue, and while not at a massive pace I am getting close to finishing it. I assume you got here because of the 'good first issue' tag, which is way underused.

If you still want to contribute to Turborepo, possibly through a different issue keep reading.

If you join the discord, perhaps someone can point you to a different issue you could pick up. If you mention me there, I'll try to get you in contact with someone who could point you in the right direction.

If you don't have discord or are unable to join the discord server for some other reason please let me know, and I'll try to get someone looking at this.

rafaeltab avatar Mar 30 '23 17:03 rafaeltab

This was merged in #3916, thanks @rafaeltab!

mehulkar avatar Jun 15 '23 19:06 mehulkar