cli icon indicating copy to clipboard operation
cli copied to clipboard

Wrap lifecycle hooks and other operations in `start`/`stop` log messages

Open joshspicer opened this issue 3 years ago • 1 comments

Recently Codespaces has gotten several reports where the root cause was difficult to debug. It would be useful if the logs emitted from the CLI clearly mark the start and end of a lifecycle script - perhaps like the following:

---  starting to execute 'postCreateCommand' script 'foo'

... foo output...

--- 'postCreateCommand' script 'foo' exited code 0

This would be particularly helpful in cases where foo does not emit any logs.

joshspicer avatar Aug 17 '22 21:08 joshspicer

It might be even better if we can prefix the log lines (in the file-based logging, not the live TTY terminal stream) with the lifecycle hook name:

2022-08-17 20:53:45.123Z: Starting to execute 'postCreateCommand' script 'foo'
2022-08-17 20:53:46.234Z: [postCreateCommand] ... foo output...
2022-08-17 20:53:47.456Z: [postCreateCommand] ... foo output...
2022-08-17 20:53:48.789Z: 'postCreateCommand' script 'foo' exited code 0

jkeech avatar Aug 17 '22 22:08 jkeech