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

Group output option #89

Closed
natew opened this issue May 16, 2020 · 6 comments
Closed

Group output option #89

natew opened this issue May 16, 2020 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@natew
Copy link

natew commented May 16, 2020

When running things concurrently using --no-pretty, the logs are mixed together from all the different processes.

You could have an option, or default to, to log out the outputs in groups. You'd have to wait for them to end of course and then just output the whole thing for each one as it ends.

Perhaps as --group-logs, though tbh it's a reasonable default.

@tshelburne
Copy link

tshelburne commented May 17, 2020

As of right now, none of the three formatting options is very helpful for debugging when using this to start multiple packages in a "development" mode. --pretty hides any output of significant length, and neither --no-pretty nor --raw prepend names to what is executing.

I would even be grateful to see something like https://www.npmjs.com/package/concurrently does where every line logged is prepended with the package name - something like:

❯ @app/api at apps/api
❯ @app/client at apps/client
❯ @app/model at apps/model
❯ @app/api start
❯ @app/client start
❯ @app/model start
❯ @app/api prestart
❯ @app/client start:app
❯ @app/model prestart
> @app/client $ parcel -d public src/index.html
❯ @app/api build
❯ @app/api [build] changes:
❯ @app/api [build]   + @types/emergent
❯ @app/api $ tsc
❯ @app/model build
❯ @app/model [build] changes:
❯ @app/model [build]   + @types/emergent
❯ @app/model $ tsc
❯ @app/client [cross-env] Server running at http://localhost:1234
❯ @app/api $ run-p start:*
❯ @app/client ✨  Built in 24.70s.

@natew
Copy link
Author

natew commented May 19, 2020

Yea prefix is helpful for watching, grouping is very useful for readable logs for one-time builds.

@folke
Copy link
Owner

folke commented May 19, 2020

--pretty actually works as the suggested --group-logs options, unless something is broken.

While running, logs are being truncated to try to show you an overview of what's happening, but once all processes finish, the full log is being flushed to the output, so effectively showing grouped output.

Could you clarify the kind of behavior you'd be looking for instead?

Apart from that, the prefix makes sense for sure. I'll make an other issue to have this implemented.

@folke folke added the question Further information is requested label May 19, 2020
@tshelburne
Copy link

@folke I'm running watched builds in 7 different packages as part of a monorepo setup. The logs in this case aren't so much about build errors as they are about app logs from the running process (eg. errors getting surfaced if API requests are missing parameters, etc.). Because the truncated logs are so short and the error trace is often so long, it's not really possible as-is to see what happened without dropping out of ultra and running the process independently. There are a few possible solutions in my mind - prefixed lines, untruncated flags, configurable writing to a logfile, etc. Basically anything that makes reviewing server log output simple.

@folke
Copy link
Owner

folke commented May 25, 2020

@tshelburne thank you for clarifying. I actually have a very similar setup for another project, but the errors are pretty small in my case most of the time.

Unfortunately it's pretty hard to make the truncation configurable. The reason for this is that I'm using terminal escape sequences to change the output. It's not possible to change output beyond what's visible on the screen. So you can't use a screen buffer bigger than your terminals amount of rows.

The only way I can think of to make this happen, would be using an ncurses like interface as blessed, but this would be beyond the scope of ultra imho.

@folke
Copy link
Owner

folke commented May 25, 2020

As mentioned before, for one off builds, --pretty already behaves as the proposed --group-logs options. Once the build finished, a full (non truncated) logs is flushed to the terminal.

I've also just released v3.4.1 which now properly adds the current package name to the --no-pretty output, for watching builds etc.

Hope this helps!

@folke folke closed this as completed May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants