Comments (16)
@cornerman, awesome. Feel free to message me on Gitter if you need anything from me.
from scribe.
Yeah, I fear that's probably the case. The problem is that in 2.0 it's heavily utilized for date formatting, which is obviously a standard feature of logging. I'd welcome a PR that removes the necessity for them or offers a more clever solution to this problem.
from scribe.
This was deployed and fixed in 2.2.0
from scribe.
Perfect, thanks a lot for the fast reaction!
from scribe.
@darkfrog26
Scribe still pulls in scala-java-locales
indirectly via perfolation
. Is it possible to remove this dependency as well?
from scribe.
@fdietze, unfortunately, for any date formatting it's required. If you have another suggestion of how to accomplish that without it, I'd be happy to consider it.
from scribe.
I understand. One could use java.util.Date
. While most methods are deprecated, it is available on the jvm and scalajs (I don't know about native). These should be enough for logging.
import java.util.Date
val d = new Date()
val year = d.getYear + 1900
val month = d.getMonth + 1
val day = d.getDate
val hour = d.getHours
val minute = d.getMinutes
val second = d.getSeconds
println(f"$year%04d-$month%02d-$day%02d $hour%02d:$minute%02d:$second%02d")
I suspect that the increased file size prevents many scalajs-projects from using scribe.
from scribe.
@fdietze while I agree, the simple use-case of date formatting would be solved with java.util.Date
, there are advanced use-cases that it does not handle. If you can offer a way to implement the methods in CrossDate
(https://github.com/outr/perfolation/blob/master/core/shared/src/main/scala/perfolation/CrossDate.scala) without using the dependency I would happily drop it.
While I agree the size is annoying, I find it unlikely it's a big issue for most people as it's incredibly common for initial loading of sites to be several meg. However, I concur that the logging library shouldn't account for a large percentage of it. ;)
from scribe.
I didn't know that you have already implemented CrossDate
using js.Date
:
https://github.com/outr/perfolation/blob/master/core/js/src/main/scala/perfolation/JavaScriptCrossDate.scala
This is great! I thought it would be using scala-java-locales
.
So as I see it now, the only problem seems to be the usage of java.util.Locale
:
https://github.com/outr/perfolation/blob/master/core/js/src/main/scala/perfolation/Platform.scala#L8
What is this line exaclty for?
from scribe.
The Scala.js implementation of Locale doesn't properly set the default locale so if you don't set that line a NPE is thrown when you try to access anything.
from scribe.
Hmm, interesting. What effect does the setDefault
of the locale have on js-date?What do you mean with "access anything" here?
For us, the file size is really a problem, because we worked hard to avoid this dependency ourselves. It pulls in all locale strings of all languages into the minified/optimized javascript bundle - which really is unnecessary. I would really like to make this optional or remove it, if it possible in any way :)
Furthermore: Can we safely assume a US
locale? How would one override this decision?
from scribe.
@cornerman and @fdietze, I would be happy to completely remove that functionality. It was intended as placeholder until we could get a better solution. If either or both of you are willing to work on a PR to perfolation or scribe I'd be happy to assist any way I can. I've re-opened this ticket as I agree this is an issue that should be solved if it can be.
from scribe.
Cool! We will try to start working on this soonish :)
from scribe.
@cornerman and @fdietze, any updates on this?
from scribe.
@darkfrog26 nothing new for now. i currently do not have much time for taking care of this. so, maybe we should remove it from the milestone if it is a blocker? eventually, we will definitely revisit this issue, because the size issue matters for us - just does not hurt enough yet :)
from scribe.
Though this was resolved in 2.7.2, it was drastically improved in 2.7.3
from scribe.
Related Issues (20)
- Scala JS source maps, map to release dir? HOT 9
- No colours when run on Node.js HOT 14
- TASTy file was produced by Scala 3.2.0 HOT 7
- [Suggestion] improve JSON logging usability HOT 5
- REPL: scribe macro NPE when the scala source file is virtual HOT 2
- Include ISO8601 datetime formatters in core HOT 7
- Logstash encoding for stdout HOT 2
- Exceptions are not logged by SLF4JHelper since 3.9.0 HOT 5
- Unable to have minimumLevel=Info and only enable Trace for certain packages HOT 11
- Overriding the path for log files HOT 4
- Help: configure stdout/stderr in function of LogLevel HOT 15
- Compare perfomance with Chronicle-Logger HOT 2
- NPE when logging with SLF4J and Throwble == null HOT 4
- Different versions of scala-collection-compat pulled in transitively HOT 3
- Logger ignores `data` field HOT 3
- AsynchronousLogHandle shutdown hook HOT 3
- MDC syntax improvement HOT 7
- Standardize JSON output ? HOT 3
- Is it safe to use MDC with cats-effect? HOT 5
- Logging stderr HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scribe.