Comments (15)
Presuming you want to turn off absolutely all logging:
Logger.root.clearHandlers()
If you want to just change the logging level to only log errors you can just define your log handler to do such:
Logger.root.addHandler(LogHandler(level = Level.Error))
If there's some other specific scenario you'd like to handle that's not covered let me know.
from scribe.
Logger.root.clearHandlers()
is what i want :) , thanks for reply.
from scribe.
I have one more question , with this logic i still pay a method call at runtime(an unit() call!) , probably i'll go with if(scalajs.LinkingInfo.developmentMode) scribe.info(..)
Edit : it's nice to see this feature built in for scala.js
instead of manually safe guarding if(scalajs.LinkingInfo.developmentMode)
everytime
from scribe.
Yes, there is a very small cost as opposed to other frameworks that compile it out entirely. However, the cost is so small I never expected it was a price not worth paying for the ability to enable debug logging in production without a recompile and restart.
from scribe.
I'd be curious if you benchmark the cost at anything higher than nanoseconds.
from scribe.
the cost at anything higher than nanoseconds.
agree, but with scalajs.LinkingInfo.developmentMode
which constant-fold the tree , output file will be smaller!, and its good to eliminate overhead if possible :)
from scribe.
However, unless I'm misunderstanding you, would require re-compiling to re-enable logging whereas the current architecture allows you to enable and disable logging in production on-demand.
from scribe.
in scala.js -
sbt ~fastOptJS => LinkingInfo.developmentMode = true LinkingInfo.productionMode = false
sbt ~fullOptJS => LinkingInfo.developmentMode = false LinkingInfo.productionMode = true
Edit :
how about scribejs.info ... , which will log only in development mode( scalajs.LinkingInfo.developmentMode), let people choose what they want(scribe or scribejs) . hope i am not misinterpreting your intentions ...
from scribe.
https://github.com/jokade/slogging#disable-logging-at-compile-time
from scribe.
I think you misunderstand. For example, in one of my client's production web applications, I have an admin interface that allows me to enable or disable debug logging while the application continues to run. This comes in handy when I'm experiencing a production issue and am having difficulties reproducing it in dev. I can enable debug or trace logging while I re-create the scenario or while something specific is occurring on the server to get the information I need, but then I disable it. This allows me to slightly decrease the performance of my production system for a few minutes to get debug or trace logging without the need to re-compile or even re-start the application. I'm not opposed to introducing the capacity to exclude logging calls during compilation for those that may want that, but to me that defeats one of the strengths of Scribe.
from scribe.
I think you misunderstand.
thats what i thought :(
I have an admin interface that allows me to enable or disable debug logging while the application continues to run
you mean ,using some properties on server ? or ..
from scribe.
No, the admin interface gives me the capacity to interact graphically with the configuration in real-time so I can make changes to the running application. In fact, I'm currently building another system based on the same concept for more generic usage (still very early development): https://github.com/outr/uberterm although it is being used in production for one of my clients.
from scribe.
oh ok , thanks for info , in my case its a mobile app . I'll vote introducing the capacity to exclude logging calls during compilation for those that may want that
👍
from scribe.
I'm fine with it if you'd like to introduce a PR for it. However, I think the debate is like complaining that your new 8tb hard drive is 5mb smaller than you expected. It's just such a small amount it really doesn't matter. :)
from scribe.
haha cool ok :)
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.