Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --grouped flag to group log output #219

Closed
2 tasks
jaredpalmer opened this issue Dec 12, 2021 · 11 comments
Closed
2 tasks

Add --grouped flag to group log output #219

jaredpalmer opened this issue Dec 12, 2021 · 11 comments
Labels
area: logging Improvements to logging good first issue Good for newcomers

Comments

@jaredpalmer
Copy link
Contributor

jaredpalmer commented Dec 12, 2021

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
@marklawlor
Copy link

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.

@satya-nutella
Copy link

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

@szk2s
Copy link

szk2s commented May 6, 2022

Would love this. Our CI log is almost useless.

@georeith
Copy link

+1 could really use this for test output

@mehulkar mehulkar added area: logging Improvements to logging story and removed story labels Oct 18, 2022
sokra pushed a commit that referenced this issue Oct 25, 2022
* Implement test app generator

* Implement basic test app generator

* Remove into_iter()

Co-authored-by: Alex Kirszenberg <alex.kirszenberg@vercel.com>

* Update crates/turbopack-create-test-app/src/main.rs

Co-authored-by: Leah <github.leah@hrmny.sh>

Co-authored-by: Alex Kirszenberg <alex.kirszenberg@vercel.com>
Co-authored-by: Leah <github.leah@hrmny.sh>
@rubiagatra
Copy link
Contributor

I'll try check this on the weekend

@ruettenm
Copy link

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 ❤️

@robaca
Copy link

robaca commented Feb 18, 2023

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.

@mehulkar
Copy link
Contributor

mehulkar commented Feb 21, 2023

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 added a commit that referenced this issue Feb 21, 2023
This adds a `--log-prefix=none` CLI argument to `turbo run` commands
that will remove the `<package>:<task>: ` prefix when running tasks
(both on execute and replay from cache). This removal will also apply to
"single package" repos where the prefix is just `<task>: `

This new option is intended to alleviate some user issues piping logs
into other tools, but comes with a Buyer Beware warning that logs from
parallel tasks are still interleaved. We may implement a buffering
mechanism (long time issue: #219), that will further help with this, but
this PR does not do that.
@rafaeltab rafaeltab mentioned this issue Feb 22, 2023
3 tasks
@DivvSaxena
Copy link

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

@rafaeltab
Copy link
Contributor

@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.

@mehulkar
Copy link
Contributor

This was merged in #3916, thanks @rafaeltab!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: logging Improvements to logging good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests