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

Fix Scala.js toolchain logs in server-client mode #3196

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

lolgab
Copy link
Member

@lolgab lolgab commented Jun 3, 2024

For some reason logging with scala.Console doesn't work with the Scala.js linker in server-client mode, maybe it's related to some classloader issue. This works around the problem by using System.out instead, which works correctly.

Pull Request: #3196

For some reason logging with `scala.Console` doesn't work with Scala.js
linker, maybe it's related to some classpath issue.
This works around the problem by using `System.out` instead, which works
correctly.
@lolgab lolgab marked this pull request as ready for review June 4, 2024 06:08
@lolgab lolgab requested review from lihaoyi and lefou June 4, 2024 06:08
private val logger = new Logger {
def log(level: Level, message: => String): Unit = level match {
case Level.Warn | Level.Error => System.err.println(message)
case Level.Info | Level.Debug => System.out.println(message)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should go all log messages to the same channel, STDERR? If a user wants to use STDOUT, she would use println instead of logging, I'd assume.

Copy link
Member Author

@lolgab lolgab Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what ConsoleScalaLogger from Scala.js does.
That would deviate from Sbt but it would mean that the Starting process: node log will be printed to stderr and not to stdout anymore, which is nice.

I don't know what's best to be honest.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the message you mentioned is predestinated to end up on STDERR. It's just tooling side-output, not the output of the actual process to run.

@lolgab lolgab requested a review from lefou June 4, 2024 07:41
@lefou lefou merged commit 3de00fa into com-lihaoyi:main Jun 4, 2024
39 checks passed
@lefou lefou added this to the 0.11.8 milestone Jun 4, 2024
@lolgab lolgab deleted the scala-js-linker-log branch June 4, 2024 13:20
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

Successfully merging this pull request may close these issues.

2 participants