title: Ruby: Send logger messages to a string variable?
body: <p>I have a small framework that is logging some info and debug messages using the Logger object built into ruby. At run time, this works great. At unit test time (using rspec if it matters...) i would like to dump the logged messages to an in memory string variable. What's the easiest way to go about doing this?</p>
  
  <p>I was considering a monkey patch that would replace the info and debug methods, like this:</p>
  
  <pre><code>
  class Logger
    def info msg
      $logs = msg
      super msg
    end
  end
  </code></pre>
  
  <p>is there a better way to go about sending my log messages to a string variable?</p>