Giter Site home page Giter Site logo

Comments (7)

mariovisic avatar mariovisic commented on July 26, 2024

You could not require the gem in your test environment, for example in your gemfile add :require => false and then manually require it in an initializer.

Another way (which is how i've done it) is to add this to your spec_helper.rb

# Make rack timeout less noisy in our tests.
Rack::Timeout.logger.formatter = ->(*args) { nil }

Maybe this is something that could be added to the readme?

from rack-timeout.

kch avatar kch commented on July 26, 2024

I'll take this into consideration but generally the solution is indeed to change/remove the logger. This will be easier in the next beta, too.

What if I don't log anything for RACK_ENV=test?

from rack-timeout.

kch avatar kch commented on July 26, 2024

So now that I've pushed all the nice stuff…

How about:

Rack::Timeout.unregister_state_change_observer(:logger) if ENV['RACK_ENV'] == 'test'

Check out the logging section way down in the readme.

from rack-timeout.

kch avatar kch commented on July 26, 2024

@wuputah what's your take here? I kinda don't feel like we should behave differently during tests. What if someone wants to test the log output itself?

The solutions presented above for silencing logs during testing are good enough for me.

from rack-timeout.

wuputah avatar wuputah commented on July 26, 2024

I'm a fan of software being very quiet by default and allowing people to opt-into logging. Perhaps the default logging level be FATAL?

from rack-timeout.

kch avatar kch commented on July 26, 2024

This will also likely be fixed by #37 if your test env sends logs to somewhere other than stderr so I'm closing it, but will take it into account for #37.

from rack-timeout.

kch avatar kch commented on July 26, 2024

So d1aed68 should address this. For example, if you're using Rails, rack-timeout will log to the rails logger, so when running tests, its logs would end up in logs/test.log.

Otherwise if you wanna remove logging entirely, I refer you back to my comment above.

from rack-timeout.

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.