gajus / turbowatch

Extremely fast file change detector and task orchestrator for Node.js.
Other
938 stars 23 forks source link

Add options to disable prefix and/or color on spawn output #47

Open eigilsagafos opened 1 year ago

eigilsagafos commented 1 year ago

I'm using turbowatch in an environment where I need more control over the output from the spawned process. The prefix and color is giving me some unnecessary additional work, so I added option to toggle those options. Hope this makes sense.

eigilsagafos commented 1 year ago

@gajus do you consider PRs for this project?

gajus commented 1 year ago

I have not had a minute to evaluate the approach.

I need to figure out how to make this more universal.

Currently leaning towards exposing a method along the lines of onMessage that allows to filter/customize the output.

virtuallyunknown commented 1 year ago

If I may voice my personal opinion, I would love to have an option such as (or similar to) the prefixOutput in this PR. When I have turbowatch run a turbo command on top of it, it becomes a bit difficult to read, since the application output becomes prefixed twice:

a6480159 > @monorepo/package:command: hello world
gajus commented 1 year ago

Just for my understanding, in what scenario would you run turbo on top of turbowatch?

gajus commented 1 year ago

We've experimented with different forms of log prefixes in our setup, including removing the prefix, and removing the prefix scored the lowest sentiment. For two days all issue reports were useless because there was no good way to track down the origin of the error. Therefore, feels like a bad pattern to allow.

gajus commented 1 year ago

I am planning to share a Twitter thread/article sometime next week about what setup we've landed on eventually. We have something that works great in terms of DX. However, it is definitely not going to be a great option for everyone because it makes heavy assumptions about the local setup (such as use of iTerm)

gajus commented 1 year ago

Happy to merge this behind a configuration, not as a default though.

virtuallyunknown commented 1 year ago

Hey gajus. First, I just want to say thank you for developing this library.

I don't consider myself knowledgeable enough to provide an opinion on your most of what you commented, but if it's helpful in any way I can simply answer your question.

Just for my understanding, in what scenario would you run turbo on top of turbowatch?

EDIT: Removing my long reply here sorry about that. I am not running turbo on top of turbowatch, just realized I misused the phrase by accident.

eigilsagafos commented 1 year ago

Thanks @gajus! Behind a flag would be great!

We have a dev server that manages several services as child processes and we centralize the logs with our own prefixes. So we are already in control and know the source. The prefix/color added noise that I had to strip away. (We also use a JSON logger so the lines will not parse with the prefix)

robknight commented 9 months ago

+1 to making this configurable.

@gajus It looks to me like this PR does what you suggested. Is it possible to merge it, or does it require further changes? I would be happy to contribute changes to get this done.