Closed cquiroz closed 6 years ago
Hi @cquiroz. I hadn't really thought about this until now. When I wrote Log4s, the design was "SLF4J is a great solution to flexible Java logging, but it would be nice if it could better leverage some of Scala's features."
Do you have any particular logging solutions for scala.js that you'd like to see supported? I haven't had occasion to do a lot of scala.js, but I've seen scala-js-java-logging.
I don't particularly want to grow Log4s into an entire logging solution that includes formatters, appenders, filters, and so on. However, I'm not at all opposed to enhancing Log4s so that it can support such a project.
I'm thinking that the right way to do this might be to actually fork out an "SL4JS" so Scala developers can use the SLF4J APIs with drop-in scala.js logging libraries.
The reason I'm interested on this is because http4s
uses log4s
and I'm attempting to port it to scala.js. Changing framework on http4s
maybe hard. I'm thinking that the api of log4s
could be re implemented without slf4j
to just provide what http4s
needs.
On the client side you have normally little need for complex configuration and nonetheless you can't really switch backends easily since there is no reflection
I'll try to implement a minimal API to get me there and submit it for consideration when completed
@cquiroz would something like scala-js-java-logging
work for your use case? It seems to be the most standard thing out there right now for logging in scala.js.
Maybe that's an option if we can change http4s
to switch
What I mean is that if I had a build of Log4s so that it could do its logging using scala-js-java-logging
, would that be suitable? Or does http4s
have its own internal logging system that you want to use?
Right, that would do I think
Did you ever progress with this, @cquiroz ?
@oyvindberg Not really. I added stubs for log4s
in http4s
@oyvindberg is there a particular logging framework that you're using as a replacement for slf4j/logback when you're working in scala.js? I have been kicking around some potential solutions to solve this (and #20), but would be interested in exactly what you're hoping to do here.
Log4s 1.6 has fairly comprehensive Scala.js support, including the ability to configure logging thresholds and appenders just as you would have with Logback or Log4j. (The flexibility is not as sophisticated as those frameworks, but it's good enough for typical JavaScript purposes and fairly extensible.)
That's great, thanks a lot!
Awesome!
@cquiroz & @oyvindberg if either of you end up trying out Scala.js support, I'd be very interested in any feedback or issues you encounter. Scala.js support is still experimental in that the configuration and JS-native APIs might change, but I think it's ready to start using. There's a fair amount of docs in the README, though I don't have Scaladocs hosted yet.
Is there any possibility to support Scala.js. Given that slf4j won't be moved to scala.js anytime soon perhaps log4s would need to have a simple implementation of the public API for scala.js
I'd like to be able to use it on https://github.com/http4s/http4s/issues/956