Support simplified output for logging
Pre-flight checklist
- [X] I have read the contribution documentation for this project.
- [X] I agree to follow the code of conduct that this project uses.
- [X] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem description
When logging output to a file the throbber isn't overwritten but appended:
⠋ Compiling Main Process Code⠙ Preparing to Package Application for arch: x64⠙ Compiling Main Process Code⠹ Preparing to Package Application for arch: x64⠹ Compiling Main Process Code⠸ Preparing to Package Application for arch: x64⠸ Compili
ng Main Process Code⠼ Preparing to Package Application for arch: x64⠼ Compiling Main Process Code⠴ Preparing to Package Application for arch: x64⠴ Compiling Mai
n Process Code⠦ Preparing to Package Application for arch: x64⠦ Compiling Main Process Code⠧ Preparing to Package Application for arch: x64⠧ Compiling Main Proc
ess Code⠇ Preparing to Package Application for arch: x64⠇ Compiling Main Process Code⠏ Preparing to Package Application for arch: x64⠏ Compiling Main Process Co
de⠋ Preparing to Package Application for arch: x64⠋ Compiling Main Process Code⠙ Preparing to Package Application for arch: x64⠙ Compiling Main Process Code⠹ Preparing to Package Application for arch: x64⠹ Compiling Main Process Code⠸ Preparing to Package Application for arch: x64⠸ Compiling Main Process Code⠼ Preparin
g to Package Application for arch: x64⠼ Compiling Main Process Code⠴ Preparing to Package Application for arch: x64⠴ Compiling Main Process Code⠦ Preparing to P
ackage Application for arch: x64⠦ Compiling Main Process Code⠧ Preparing to Package Application for arch: x64⠧ Compiling Main Process Code⠇ Preparing to Package
Application for arch: x64
Proposed solution
Provide a flag that suppresses the throbber animation.
Alternatives considered
Many command line utilities try to detect whether they're writing to a TTY to toggle behavior automatically. Like how ls suppresses coloring when you pipe to less. Ideally there would still be a way to force output format when you want to.
Additional information
No response
Many command line utilities try to detect whether they're writing to a TTY to toggle behavior automatically.
The ora docs mention that this should happen automatically 🤔
If [the
isEnabledflag] is not specified, the spinner will be enabled if the stream is being run inside a TTY context (not spawned or piped) and/or not in a CI environment.
We don't use that flag in Forge's code, either.
Could it be due to the ora version? The yarn.lock has ora versions 5.x and 6.0.0.
Update: we're currently in the process of replacing Ora with listr2 as well. Not sure what the implications are for this issue but we'll revisit!
Piping listr2 output to a file works as expected, closing this out as we've already landed listr2 support for start/init and package et. al is on the way in #3043