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

Logger writes to stderr not stdout? #1024

Closed
zaydek opened this issue Mar 20, 2021 · 4 comments
Closed

Logger writes to stderr not stdout? #1024

zaydek opened this issue Mar 20, 2021 · 4 comments

Comments

@zaydek
Copy link

zaydek commented Mar 20, 2021

Not sure if this is intentional but the behavior slightly surprised me when I was working on something else. Here’s a minimal repro screenshot.

Screen Shot 2021-03-20 at 11 01 53 PM

@kzc
Copy link
Contributor

kzc commented Mar 20, 2021

Logging to stdout would interfere with pipes between processes.

$ echo 'console.log({a: 0, a: 1 ? 2 : 3})' | esbuild --minify | node
 > <stdin>:1:19: warning: Duplicate key "a" in object literal
    1 │ console.log({a: 0, a: 1 ? 2 : 3})
      ╵                    ^
   <stdin>:1:13: note: The original "a" is here
    1 │ console.log({a: 0, a: 1 ? 2 : 3})
      ╵              ^

1 warning
{ a: 2 }
$ echo 'console.log({a: 0, a: 1 ? 2 : 3})' | esbuild --minify 2>/dev/null | node
{ a: 2 }

@zaydek
Copy link
Author

zaydek commented Mar 20, 2021

That makes sense. This is probably intentional behavior then. Thank you -- closing.

@zaydek zaydek closed this as completed Mar 20, 2021
@hardfist
Copy link
Contributor

hardfist commented May 3, 2021

It causes problems when esbuild is used in rushjs, which detect stderr output as warning, and it will terminate build if the build process generates warning info in CI environment, and it also invalidate rushjs's build cache. microsoft/rushstack#1329

@evanw
Copy link
Owner

evanw commented May 3, 2021

This is what the log level setting is for:

  • silent
    Do not show any log output.

  • error
    Only show errors.

  • warning
    Only show warnings and errors.

  • info
    Show warnings, errors, and an output file summary. This is the default log level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants