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

ts-loader should not log compilerDetailsLogMessage when profiling #488

Closed
klavs opened this issue Feb 28, 2017 · 10 comments
Closed

ts-loader should not log compilerDetailsLogMessage when profiling #488

klavs opened this issue Feb 28, 2017 · 10 comments

Comments

@klavs
Copy link

klavs commented Feb 28, 2017

The following line fails to create a valid JSON because compilerDetailsLogMessage gets logged before the json.

webpack --profile --json > stats.json

compilerDetailsLogMessage should not be logged when printing webpack stats.

@johnnyreilly
Copy link
Member

PRs welcome!

@klavs
Copy link
Author

klavs commented Mar 10, 2017

@sokra, @TheLarkInn, @jhnns
It makes sense to me that ts-loader outputs the tsc version and tsconfig location. Is there a way to print this info the same way as webpack does with Hash, Version and Time?

It does not seem reasonable to create a white list of cases when a loader can print something out as webpack can add new features at any time.

@jhnns
Copy link

jhnns commented Mar 10, 2017

Is there a way to print this info the same way as webpack does with Hash, Version and Time

No, I don't think so. We would need to expose a logger on the loader context. That would be a reasonable change.

Personally, I think the loader should only output something to the console if a debug flag is set.

@klavs
Copy link
Author

klavs commented Mar 10, 2017

Thanks @jhnns for your input.
@johnnyreilly, what do you think about logging only if debug flag is set?

@cletusw
Copy link

cletusw commented Mar 10, 2017

Is there a way to print this info the same way as webpack does with Hash, Version and Time

I know that the webpack progress indicator logs to stderr and it correctly doesn't get included in the redirected output.

@cletusw
Copy link

cletusw commented Mar 10, 2017

Interesting, looks like this should be logging to stderr as well. https://github.com/TypeStrong/ts-loader#loginfotostdout-boolean-defaultfalse

@simon04
Copy link
Contributor

simon04 commented Jun 22, 2017

Having a 68 line logging module plus external colouring library seems to be an overkill for a total 5 logging invocations. Any reason not to simply use console.warn, console.error?

@johnnyreilly
Copy link
Member

For version 3 of ts-loader we'll be changing the default log level to warn. Once that lands users will no longer be affected by this. #631 (my own "aha" moment came when I realised I was using ts-loader in silent mode by choice)

@johnnyreilly
Copy link
Member

Closed with 3.0

@jhnns
Copy link

jhnns commented Nov 3, 2017

That's a good idea 👍. stderr was invented exactly for this purpose 😁

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

5 participants