serverless / compose

Orchestrate Serverless Framework in monorepos
https://serverless.com/framework/docs/guides/compose
MIT License
111 stars 15 forks source link

Framework logs command: write a part of the output to stderr #14

Closed mnapoli closed 2 years ago

mnapoli commented 2 years ago
image

This part of the output is written to stdout, it should probably be written to stderr instead:

Environment: darwin, node 17.4.0, framework 3.2.1, plugin 6.1.0, SDK 4.3.1
Credentials: Local, "default" profile
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

This isn't a huge deal, but I think it's a change that makes sense: keep the stdout output very lean and to the point (the pure error message). All other supporting logs are for humans, they should go to stderr.

This will help Components because it will make streaming logs a bit better. Here is the current output:

❯ sls4 logs
users › list › Environment: darwin, node 17.4.0, framework 3.2.1, plugin 6.1.0, SDK 4.3.1
users › list › Credentials: Local, "default" profile
users › list › Docs:        docs.serverless.com
users › list › Support:     forum.serverless.com
users › list › Bugs:        github.com/serverless/serverless/issues
users › home › START
users › home › 2022-02-20 12:12:14.392  INFO    New user signup
users › home › END Duration: 2.91 ms    Billed Duration: 3 ms   Memory Size: 1024 MB    Max Memory Used: 56 MB  Init Duration: 159.28 ms

Since in components we stream stdout (not stderr), that will make it easy to cleanup the Components output here.

Not a priority. Just taking notes as it seems to be a quick win to make sls logs work better here.