devcontainers / cli

A reference implementation for the specification that can create and configure a dev container from a devcontainer.json.
https://containers.dev
MIT License
1.39k stars 192 forks source link

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

Open joshspicer opened 1 year ago

joshspicer commented 1 year ago

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.

jkeech commented 1 year ago

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