log_buddy 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,12 +1,12 @@
1
- v0.2.0 Better log output of objects based on their type, very similiar to Logger/irb behavior; update to micronaut 0.1.0
1
+ v0.2.0. Better log output of objects based on their type, very similar to Logger/irb behavior; update to micronaut 0.1.0
2
2
 
3
- v0.1.5 Clean up specs and remove noise from spec run
3
+ v0.1.5. Clean up specs and remove noise from spec run
4
4
 
5
- v0.1.4 Micronauts Unite! Test Suite now runs via Micronaut - http://github.com/spicycode/micronaut/
5
+ v0.1.4. Micronauts Unite! Test Suite now runs via Micronaut - http://github.com/spicycode/micronaut/
6
6
 
7
- v0.1.3 Use plain old echoe; really fix rubygems errors (I hope)
7
+ v0.1.3. Use plain old echoe; really fix rubygems errors (I hope)
8
8
 
9
- v0.1.2 Attempting to fix rubygems errors
9
+ v0.1.2. Attempting to fix rubygems errors
10
10
 
11
11
  v0.1.1. Handle exceptions from within the block
12
12
 
data/README.rdoc CHANGED
@@ -8,7 +8,7 @@ log_buddy is your friendly little log buddy at your side, helping you dev, debug
8
8
 
9
9
  Require the init.rb file to use log_buddy. By default, it will add two methods to every object at the instance and class level: "d" and "logger". To use log_buddy without the automatic object intrusion, set ENV["SAFE_LOG_BUDDY"] = true before requiring the init.rb.
10
10
 
11
- You can use your own logger with Logbuddy by passing it into init's options hash:
11
+ You can use your own logger with LogBuddy by passing it into init's options hash:
12
12
 
13
13
  LogBuddy.init :default_logger => Logger.new('my_log.log')
14
14
 
@@ -38,6 +38,10 @@ in the block and the result. Examples:
38
38
 
39
39
  See examples.rb for live examples you can run.
40
40
 
41
+ When you occasionally want to disable LogBuddy (but you don't want to have to remove all your debug statements), you can pass the :disabled option into init's options hash:
42
+
43
+ LogBuddy.init :disabled => true
44
+
41
45
  == REQUIREMENTS:
42
46
 
43
47
  * Ruby 1.8.6 or JRuby (tested with 1.1RC3)
@@ -55,9 +59,9 @@ See examples.rb for live examples you can run.
55
59
  == URLS
56
60
 
57
61
  * Log bugs, issues, and suggestions at Lighthouse: http://relevance.lighthouseapp.com/projects/19074-log-buddy/overview
58
- * View Source: http://github.com/relevance/logbuddy
59
- * Git clone Source: git://github.com/relevance/logbuddy.git
60
- * Continuous Integration: http://runcoderun.com/relevance/logbuddy
62
+ * View Source: http://github.com/relevance/log_buddy
63
+ * Git clone Source: git://github.com/relevance/log_buddy.git
64
+ * Continuous Integration: http://runcoderun.com/relevance/log_buddy
61
65
  * RDocs: http://thinkrelevance.rubyforge.org/log_buddy
62
66
 
63
67
  == LICENSE:
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ echoe = Echoe.new('log_buddy', LogBuddy::VERSION::STRING) do |p|
9
9
  p.email = 'opensource@thinkrelevance.com'
10
10
  p.summary = 'Log Buddy is your little development buddy.'
11
11
  p.description = 'Log statements along with their name easily. Mixin a logger everywhere when you need it.'
12
- p.url = "http://github.com/relevance/logbuddy"
12
+ p.url = "http://github.com/relevance/log_buddy"
13
13
  p.rdoc_pattern = /^(lib|bin|ext)|txt|rdoc|gemspec|CHANGELOG|LICENSE$/
14
14
  rdoc_template = `allison --path`.strip << ".rb"
15
15
  p.rdoc_template = rdoc_template
@@ -43,4 +43,5 @@ task :default => 'micronaut:coverage'
43
43
 
44
44
  echoe.spec.add_development_dependency "echoe"
45
45
  echoe.spec.add_development_dependency "allison"
46
- echoe.spec.add_development_dependency "markaby"
46
+ echoe.spec.add_development_dependency "markaby"
47
+ echoe.spec.add_development_dependency "spicycode-micronaut"
@@ -1,6 +1,6 @@
1
1
  require 'logger'
2
2
  require 'rubygems'
3
- gem 'spicycode-micronaut', "~> 0.1.0"
3
+ gem 'spicycode-micronaut', "~> 0.1.5"
4
4
  gem 'mocha'
5
5
  require "mocha"
6
6
  require 'micronaut'
@@ -15,6 +15,6 @@ end
15
15
 
16
16
  Micronaut.configure do |config|
17
17
  config.mock_with :mocha
18
- end
19
-
20
- Micronaut::Runner.autorun
18
+ config.filter_run :options => { :focused => true }
19
+ config.autorun!
20
+ end
@@ -25,6 +25,13 @@ describe LogBuddy do
25
25
  ENV["SAFE_LOG_BUDDY"] = nil
26
26
  end
27
27
 
28
+ it "should be disabled when the :disabled key is true" do
29
+ LogBuddy.init(:disabled => true)
30
+ fake_logger = mock('logger')
31
+ LogBuddy.stubs(:logger).returns(fake_logger)
32
+ fake_logger.expects(:debug).never
33
+ d { "Hello, World!" }
34
+ end
28
35
  end
29
36
 
30
37
  end
data/lib/log_buddy.rb CHANGED
@@ -26,9 +26,11 @@ module LogBuddy
26
26
  # * <tt>:logger</tt> - the logger instance that LogBuddy should use (if not provided,
27
27
  # tries to default to RAILS_DEFAULT_LOGGER, and then to a STDOUT logger).
28
28
  # * <tt):log_to_stdout</tt> - whether LogBuddy should _also_ log to STDOUT, very helpful for Autotest (default is +true+).
29
+ # * <tt>:disabled</tt> - when true, LogBuddy will not produce any output
29
30
  def self.init(options = {})
30
31
  @logger = options[:logger]
31
32
  @log_to_stdout = options.has_key?(:log_to_stdout) ? options[:log_to_stdout] : true
33
+ @disabled = (options[:disabled] == true)
32
34
  mixin_to_object
33
35
  end
34
36
 
@@ -2,6 +2,7 @@ module LogBuddy
2
2
  module Utils
3
3
 
4
4
  def debug(obj)
5
+ return if @disabled
5
6
  str = obj_to_string(obj)
6
7
  stdout_puts(str) if log_to_stdout?
7
8
  logger.debug(str)
@@ -2,7 +2,7 @@ module LogBuddy
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 0
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/log_buddy.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{log_buddy}
5
- s.version = "0.2.0"
5
+ s.version = "0.2.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Rob Sanheim - Relevance"]
9
- s.date = %q{2008-12-09}
9
+ s.date = %q{2009-01-09}
10
10
  s.description = %q{Log statements along with their name easily. Mixin a logger everywhere when you need it.}
11
11
  s.email = %q{opensource@thinkrelevance.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "lib/log_buddy/mixin.rb", "lib/log_buddy/utils.rb", "lib/log_buddy/version.rb", "lib/log_buddy.rb", "LICENSE", "log_buddy.gemspec", "README.rdoc"]
13
13
  s.files = ["CHANGELOG", "examples/example_helper.rb", "examples/log_buddy_example.rb", "examples/log_buddy_init_example.rb", "examples/log_example.rb", "examples.rb", "init.rb", "lib/log_buddy/mixin.rb", "lib/log_buddy/utils.rb", "lib/log_buddy/version.rb", "lib/log_buddy.rb", "LICENSE", "log_buddy.gemspec", "Manifest", "Rakefile", "README.rdoc"]
14
14
  s.has_rdoc = true
15
- s.homepage = %q{http://github.com/relevance/logbuddy}
15
+ s.homepage = %q{http://github.com/relevance/log_buddy}
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Log_buddy", "--main", "README.rdoc"]
17
17
  s.require_paths = ["lib"]
18
18
  s.rubyforge_project = %q{thinkrelevance}
@@ -28,16 +28,19 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency(%q<echoe>, [">= 0"])
29
29
  s.add_development_dependency(%q<allison>, [">= 0"])
30
30
  s.add_development_dependency(%q<markaby>, [">= 0"])
31
+ s.add_development_dependency(%q<spicycode-micronaut>, [">= 0"])
31
32
  else
32
33
  s.add_dependency(%q<echoe>, [">= 0"])
33
34
  s.add_dependency(%q<echoe>, [">= 0"])
34
35
  s.add_dependency(%q<allison>, [">= 0"])
35
36
  s.add_dependency(%q<markaby>, [">= 0"])
37
+ s.add_dependency(%q<spicycode-micronaut>, [">= 0"])
36
38
  end
37
39
  else
38
40
  s.add_dependency(%q<echoe>, [">= 0"])
39
41
  s.add_dependency(%q<echoe>, [">= 0"])
40
42
  s.add_dependency(%q<allison>, [">= 0"])
41
43
  s.add_dependency(%q<markaby>, [">= 0"])
44
+ s.add_dependency(%q<spicycode-micronaut>, [">= 0"])
42
45
  end
43
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_buddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Sanheim - Relevance
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-09 00:00:00 -05:00
12
+ date: 2009-01-09 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -52,6 +52,16 @@ dependencies:
52
52
  - !ruby/object:Gem::Version
53
53
  version: "0"
54
54
  version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: spicycode-micronaut
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
55
65
  description: Log statements along with their name easily. Mixin a logger everywhere when you need it.
56
66
  email: opensource@thinkrelevance.com
57
67
  executables: []
@@ -85,7 +95,7 @@ files:
85
95
  - Rakefile
86
96
  - README.rdoc
87
97
  has_rdoc: true
88
- homepage: http://github.com/relevance/logbuddy
98
+ homepage: http://github.com/relevance/log_buddy
89
99
  post_install_message:
90
100
  rdoc_options:
91
101
  - --line-numbers