title: How do you define a custom logger without breaking your guard tests
body: <p>short question above, more details below (mostly unneccessary but figured they could be useful). I'm kind of new to guard and relatively new to rails but I've set up a nicely working rails project with guard running correctly (with rspec). The main thing is that both guard and the custom logger work perfectly and as expected by themselves but the logger will break guard when it is enabled.</p>
  
  <p>details follow: if I define a custom logger like so:</p>
  
  <pre><code>logfile = File.open("#{Rails.root}/log/my.log", 'a')
  logfile.sync=true
  MY_LOGGER = Logger.new(logfile)
  </code></pre>
  
  <p>in a file such as "/lib/assets/my_logger.rb"</p>
  
  <p>if I require this in my config/development.rb file like so:</p>
  
  <pre><code>require "assets/my_logger"
  </code></pre>
  
  <p>then I can use this logger within any of my controllers, however as soon as I put it in there, e.g.</p>
  
  <pre><code>class SessionsController &lt; ApplicationController
  
    def new
    end
  
    def create
      user = User.find_by(email: params[:session][:email].downcase)
      if user &amp;&amp; user.authenticate(params[:session][:password])
        sign_in user
        redirect_back_or user
      else
        flash.now[:error] = 'Invalid email/password combination'
        render 'new'
        MY_LOGGER.info "this will break guard tests"
      end
    end
  
    def destroy
      sign_out
      redirect_to root_url
    end
  end
  </code></pre>
  
  <p>Then my guard tests that depend on this action in the controller will break:</p>
  
  <p>(with MY_LOGGER line commented above):</p>
  
  <pre><code>16:56:33 - INFO - Running: spec/requests/authentication_pages_spec.rb
  Running tests with args ["--drb", "-f", "progress", "-r", "/Users/crashandburn4/.rvm/gems/ruby-2.0.0-p0/gems/guard-rspec-2.5.0/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/requests/authentication_pages_spec.rb"]...
  ..................
  
  Finished in 1.61 seconds
  18 examples, 0 failures
  </code></pre>
  
  <p>(with line in place)</p>
  
  <pre><code>16:56:19 - INFO - Running: spec/requests/authentication_pages_spec.rb
  Running tests with args ["--drb", "-f", "progress", "-r", "/Users/crashandburn4/.rvm/gems/ruby-2.0.0-p0/gems/guard-rspec-2.5.0/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/requests/authentication_pages_spec.rb"]...
  ..FFF.............
  
  Failures:
  
    1) Authentication signin with invalid information 
       Failure/Error: it { should have_title('Sign in') }
         expected #has_title?("Sign in") to return true, got false
       # ./spec/requests/authentication_pages_spec.rb:20:in `block (4 levels) in &lt;top (required)&gt;'
  
    2) Authentication signin with invalid information 
       Failure/Error: it { should have_selector('div.alert.alert-error', text: 'Invalid') }
         expected #has_selector?("div.alert.alert-error", {:text=&gt;"Invalid"}) to return true, got false
       # ./spec/requests/authentication_pages_spec.rb:21:in `block (4 levels) in &lt;top (required)&gt;'
  
    3) Authentication signin with invalid information after visiting another page 
       Failure/Error: before { click_link "Home" }
       Capybara::ElementNotFound:
         Unable to find link "Home"
       # ./spec/requests/authentication_pages_spec.rb:23:in `block (5 levels) in &lt;top (required)&gt;'
  
  Finished in 1.62 seconds
  18 examples, 3 failures
  
  Failed examples:
  
  rspec ./spec/requests/authentication_pages_spec.rb:20 # Authentication signin with invalid information 
  rspec ./spec/requests/authentication_pages_spec.rb:21 # Authentication signin with invalid information 
  rspec ./spec/requests/authentication_pages_spec.rb:24 # Authentication signin with invalid information after visiting another page
  </code></pre>
  
  <p>(apologies for the unneccessary stacktraces)</p>
  
  <p>now I've been looking around at the guard github page but can't easily find anywhere it says anything about enabling my custom logger so that it is ignored by guard, does anyone know how to achieve this?</p>