Skip to content
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

[Bug]: Logging should be done to STDERR by default. STDOUT should be reserved for scriptable output. #3863

Open
2 tasks done
charlespwd opened this issue May 7, 2024 · 1 comment
Labels
Area: Housekeeping Type: Bug Something isn't working

Comments

@charlespwd
Copy link
Contributor

charlespwd commented May 7, 2024

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Other

Expected behavior

I noticed that logging is done by default to STDOUT (even debug logging, for theme check anyway). Shouldn’t that be sent to STDERR by default?

Logging to STDOUT when it isn’t meant to be captured by a script makes the CLI non-composable/non-scriptable.

For instance, shopify theme check --verbose --output json will have non-JSON output in STDOUT and makes | jq break.

IMO STDOUT should be intentional, not the default.

Actual behavior

IMO all of these should use STDERR by default. STDOUT is the wrong default.

  • outputDebug should log to STDERR by default (console.error)
  • outputInfo
  • outputWarn

Verbose output

$ shopify theme check --output json --verbose | jq .
jq: parse error: Invalid numeric literal at line 1, column 14

Reproduction steps

  1. shopify theme check --output json --verbose | jq . -- get malformed JSON because debug logging isn't JSON.

Operating System

All

Shopify CLI version (check your project's package.json if you're not sure)

3.60

@knjshimi
Copy link

knjshimi commented May 7, 2024

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Housekeeping Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants