Skip to content

Writes a log message to stderr even when everything is OK #249

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

Closed
SteveSandersonMS opened this issue Jul 18, 2016 · 5 comments
Closed

Writes a log message to stderr even when everything is OK #249

SteveSandersonMS opened this issue Jul 18, 2016 · 5 comments

Comments

@SteveSandersonMS
Copy link

When ts-loader starts up, it logs messages like this to stderr:

ts-loader: Using typescript@1.8.10 and /some/path/tsconfig.json

This is because the log function calls console.log.apply(console, message), and the console variable is overridden as follows:

var console = new Console(process.stderr);

I know most of the log values outputted by ts-loader are errors, but the Using typescript@... message isn't an error. Logging it to stderr isn't great, because many apps are configured to treat stderr output as actual errors (and write it to a DB, email an administrator, etc.)

I am aware this can be suppressed by setting silent to true, but then this suppresses other potentially useful error information.

Would it be possible not to log the Using typescript@... to stderr, but still log other messages to stderror?

@jbrantly
Copy link
Member

See #95 for a discussion on this.

@johnnyreilly
Copy link
Member

Hi @SteveSandersonMS,

Is this still a problem for you? If so I think we're open to PRs (the discussion in #95 may be useful)

@SteveSandersonMS
Copy link
Author

Is this still a problem for you?

Thanks for getting back to me. No, it's not still a problem: we set silent to true by default in the project templates, and nobody has complained :)

@johnnyreilly
Copy link
Member

Awesome 😄 As it happens we're likely to merge this PR which should provide an option to control this. Not that you seem to need it but it should be there soon!

johnnyreilly pushed a commit that referenced this issue Oct 17, 2016
)

* Add explicit info logger to avoid writing info logs to stderr

* Add a loaderOption for the logLevel and logging to different logLevels

* Fix tsc compile error

* Add a new loaderOption to specify the info logging output.

* Change documentation text according to review advise

* Doing uppercase on loaderOptions logLevel just once

* Bugfix the default value of logLevel must be string
@johnnyreilly
Copy link
Member

Released with 0.9.4

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

3 participants