GithubHelp home page GithubHelp logo

how can i disable logging ? about scribe HOT 15 CLOSED

outr avatar outr commented on June 4, 2024
how can i disable logging ?

from scribe.

Comments (15)

darkfrog26 avatar darkfrog26 commented on June 4, 2024

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.

chandu0101 avatar chandu0101 commented on June 4, 2024

Logger.root.clearHandlers() is what i want :) , thanks for reply.

from scribe.

chandu0101 avatar chandu0101 commented on June 4, 2024

@darkfrog26

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.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

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.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

I'd be curious if you benchmark the cost at anything higher than nanoseconds.

from scribe.

chandu0101 avatar chandu0101 commented on June 4, 2024

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.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

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.

chandu0101 avatar chandu0101 commented on June 4, 2024

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.

chandu0101 avatar chandu0101 commented on June 4, 2024

https://github.com/jokade/slogging#disable-logging-at-compile-time

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

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.

chandu0101 avatar chandu0101 commented on June 4, 2024

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.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

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.

chandu0101 avatar chandu0101 commented on June 4, 2024

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.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

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.

chandu0101 avatar chandu0101 commented on June 4, 2024

haha cool ok :)

from scribe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.