-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
cmd: clean up generate stdout/stderr #439
Comments
Good points. I'd be up for a redesign of the templ output. I like to see the feedback that "stuff is happening", especially in watch mode, but it is a little noisy. It outputs so much that it obscures any application logging output that's happening at the same time. I'd really like to see something like a bubbletea style interface for interactive sessions (https://github.com/charmbracelet/bubbletea) where you can see a short summary of whether templ is working, and maybe show/hide your own application logging too. In the interactive mode, it would probably show something like the last time it ran (5 seconds ago etc.), how long each run is estimated to take, when the app was last restarted, a progress bar if it's running a generate, a tail of the underlying app logs, and maybe the last few HTTP request/response operations from the proxy. Along with that (as the default), a So, support two modes, interactive, and a plain version for CI/CD and integration into other workflows. |
I've introduced a new structured logger, with a custom colourised handler in #470 while I was rewriting everything. I thought that a fancy TUI was overkill once the output was tidied up. By default, it logs at
It's now under a verbose flag. You can set However, I've kept the logs on stdout, since go's slog handler only has the choice of one and the logs are the program output. |
Update on this one. Decided to log to |
First off, thank you for this amazing tool. I am loving the experience with templ so far! I do have some small ideas which would improve quality of life when using
templ generate
.There's two small improvements to the UX of the CLI tool that we can make:
1, stdout
Each time
templ generate
runs, it sends a very large amount of text to stdout on success. This is at odds with how most Unix and Go tools work, since those generate no output on success. Ideallytempl generate
would behave like other tools and not output hundreds of lines on every build in a large project, as this effectively wipes my terminal on each run given how many lines it outputs.If we want to output debug information like how long every file took to generate, that should be under a verbose flag.
To work around this, I've started using
templ generate 1>/dev/null
in a Makefile, but this leads me to my next issue.2. stderr
Failures/errors are outputted to stdout, so when I get an error, if I'm discarding the noise from stdout, I get no output or an unhelpful error:
The text was updated successfully, but these errors were encountered: