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 a way to name watch instances #31

Open
gajus opened this issue Mar 22, 2023 · 0 comments
Open

Add a way to name watch instances #31

gajus opened this issue Mar 22, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@gajus
Copy link
Owner

gajus commented Mar 22, 2023

This is a problem when running multiple Turbowatch scripts, e.g. turbowatch **/turbowatch.ts

If the above execution produces these logs:

[13:12:10.202]   0ms debug @turbowatch #subscribe: generate (0ee94688): initial run...
[13:12:10.204]   2ms debug @turbowatch #subscribe: generate (0ee94688): started task
[13:12:10.204]   0ms debug @turbowatch #subscribe: build (c82d7857): initial run...
[13:12:10.205]   1ms debug @turbowatch #subscribe: build (c82d7857): started task

then there is no way of knowing which instance of turbowatch.ts these logs are originating from.

I think the solution is quite simple here. We just need to allow name property in defineConfig and prepend that to the trigger name, e.g.

[13:12:10.202]   0ms debug @turbowatch #subscribe: slonik:generate (0ee94688): initial run...
[13:12:10.204]   2ms debug @turbowatch #subscribe: utilities:generate (0ee94688): started task
[13:12:10.204]   0ms debug @turbowatch #subscribe: utilities:build (c82d7857): initial run...
[13:12:10.205]   1ms debug @turbowatch #subscribe: slonik:build (c82d7857): started task

My slight problem with this is that adding a variable length prefix will break log alignment. Something that needs to be considered if we want to maintain pretty output.

@gajus gajus added the enhancement New feature or request label Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant