<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,4 @@
+* Removed the logger nightmare (julik)
 * Use streams for file uploads instead of in-memory strings (Julik)
 
 == 0.5.0 / 2009-01-07</diff>
      <filename>History.txt</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,6 @@ TODO.txt
 lib/youtube_g.rb
 lib/youtube_g/chain_io.rb
 lib/youtube_g/client.rb
-lib/youtube_g/logger.rb
 lib/youtube_g/model/author.rb
 lib/youtube_g/model/category.rb
 lib/youtube_g/model/contact.rb</diff>
      <filename>Manifest.txt</filename>
    </modified>
    <modified>
      <diff>@@ -55,6 +55,13 @@ Advanced queries (with boolean operators OR (either), AND (include), NOT (exclud
 	
   client.videos_by(:categories =&gt; { :either =&gt; [:news, :sports], :exclude =&gt; [:comedy] }, :tags =&gt; { :include =&gt; ['football'], :exclude =&gt; ['soccer'] })
 
+== LOGGING
+
+YouTubeG passes all logs through the logger variable on the class itself. In Rails context, assign the Rails logger to that variable to collect the messages
+(don't forget to set the level to debug):
+
+ YouTubeG.logger = RAILS_DEFAULT_LOGGER
+ RAILS_DEFAULT_LOGGER.level = Logger::DEBUG
 
 == REQUIREMENTS:
 </diff>
      <filename>README.txt</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,32 @@ class YouTubeG
   def self.esc(s) #:nodoc:
     s.to_s.gsub(/[^ \w.-]+/n){'%'+($&amp;.unpack('H2'*$&amp;.size)*'%').upcase}.tr(' ', '+')
   end
+  
+  # Set the logger for the library
+  def self.logger=(any_logger)
+    @logger = any_logger
+  end
+
+  # Get the logger for the library (by default will log to STDOUT). TODO: this is where we grab the Rails logger too
+  def self.logger
+    @logger ||= create_default_logger
+  end
+  
+  # Gets mixed into the classes to provide the logger method
+  module Logging #:nodoc:
+    
+    # Return the base logger set for the library
+    def logger
+      YouTubeG.logger
+    end
+  end
+    
+  private
+    def self.create_default_logger
+      logger = Logger.new(STDOUT)
+      logger.level = Logger::DEBUG
+      logger
+    end
 end
 
 %w( </diff>
      <filename>lib/youtube_g.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,9 @@
 class YouTubeG
   class Client
-    attr_accessor :logger
+    include YouTubeG::Logging
     
-    def initialize(logger=false)
-      @logger = Logger.new(STDOUT) if logger
+    # Previously this was a logger instance but we now do it globally
+    def initialize(legacy_debug_flag = nil)
     end
     
     # Retrieves an array of standard feed, custom query, or user videos.
@@ -53,7 +53,7 @@ class YouTubeG
         request = YouTubeG::Request::StandardSearch.new(params, request_params)
       end
       
-      logger.debug &quot;Submitting request [url=#{request.url}].&quot; if logger
+      logger.debug &quot;Submitting request [url=#{request.url}].&quot;
       parser = YouTubeG::Parser::VideosFeedParser.new(request.url)
       parser.parse
     end</diff>
      <filename>lib/youtube_g/client.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,3 @@
 class YouTubeG
-  VERSION = '0.5.0'
+  VERSION = '0.5.1'
 end
\ No newline at end of file</diff>
      <filename>lib/youtube_g/version.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,6 @@
 require 'rubygems'
 require 'test/unit'
 require 'pp'
-require File.dirname(__FILE__) + '/../lib/youtube_g'
\ No newline at end of file
+require File.dirname(__FILE__) + '/../lib/youtube_g'
+
+YouTubeG.logger.level = Logger::ERROR
\ No newline at end of file</diff>
      <filename>test/helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -153,14 +153,13 @@ class TestClient &lt; Test::Unit::TestCase
     assert_valid_video video
   end
 
-  def test_should_disable_debug_if_debug_is_set_to_false
+  def test_should_always_return_a_logger
     @client = YouTubeG::Client.new
-    assert_nil @client.logger
+    assert_not_nil @client.logger
   end
   
-  def test_should_enable_logger_if_debug_is_true
-    @client = YouTubeG::Client.new(true)
-    assert_not_nil @client.logger
+  def test_should_not_bail_if_debug_is_true
+    assert_nothing_raised { YouTubeG::Client.new(true) }
   end
   
   def test_should_determine_if_nonembeddable_video_is_embeddable</diff>
      <filename>test/test_client.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/youtube_g/logger.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>767faeefda2e257b794d7a30588121d133f3221a</id>
    </parent>
  </parents>
  <author>
    <name>Julik</name>
    <email>me@julik.nl</email>
  </author>
  <url>http://github.com/tmm1/youtube-g/commit/29eeee5854fb99fe2c106a44068bc94d0e138767</url>
  <id>29eeee5854fb99fe2c106a44068bc94d0e138767</id>
  <committed-date>2009-03-02T11:01:15-08:00</committed-date>
  <authored-date>2009-03-02T11:01:15-08:00</authored-date>
  <message>Remove the &quot;if logger&quot; situation and explain how to control logging by hand. Rewriting the Logger class here is an odd entertainment practice</message>
  <tree>38af6b84a445583d6259ec79c47492c3cb2a6df9</tree>
  <committer>
    <name>Julik</name>
    <email>me@julik.nl</email>
  </committer>
</commit>
