yell 0.13.1 → 0.13.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,6 +57,13 @@ module Yell #:nodoc:
57
57
  Yell::Repository[ name ] = logger
58
58
  end
59
59
 
60
+ # Shortcut to Yell::Repository.loggers
61
+ #
62
+ # @return [Hash] The map of loggers
63
+ def loggers
64
+ Yell::Repository.loggers
65
+ end
66
+
60
67
  # Shortcut to Yell::Fomatter.new
61
68
  #
62
69
  # @return [Yell::Formatter] A Yell::Formatter instance
@@ -70,7 +77,11 @@ module Yell #:nodoc:
70
77
  end
71
78
 
72
79
  def env #:nodoc:
73
- ENV['YELL_ENV'] || ENV['RACK_ENV'] ||ENV['RAILS_ENV'] || 'development'
80
+ if defined?( Rails )
81
+ return Rails.env
82
+ end
83
+
84
+ ENV['YELL_ENV'] || ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
74
85
  end
75
86
 
76
87
  def _deprecate( version, message, options = {} ) #:nodoc:
@@ -34,6 +34,13 @@ module Yell #:nodoc:
34
34
  synchronize { instance.loggers[name] }
35
35
  end
36
36
 
37
+ # Get the list of all loggers in the repository
38
+ #
39
+ # @return [Hash] The map of loggers
40
+ def self.loggers
41
+ synchronize { instance.loggers }
42
+ end
43
+
37
44
  # Clears all logger instances (handy for testing)
38
45
  def self.clear
39
46
  synchronize { instance.loggers.clear }
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Yell #:nodoc:
4
- VERSION = "0.13.1"
4
+ VERSION = "0.13.2"
5
5
 
6
6
  end
7
7
 
@@ -84,6 +84,11 @@ describe Yell::Formatter do
84
84
  end
85
85
  end
86
86
 
87
+ context "NoFormat" do
88
+ subject { Yell::NoFormat }
89
+ it { format.should == "Hello World!" }
90
+ end
91
+
87
92
  context "DefaultFormat" do
88
93
  subject { Yell::DefaultFormat }
89
94
  it { format.should == "#{time.iso8601} [ INFO] #{$$} : Hello World!" }
@@ -4,7 +4,7 @@ describe Yell::Repository do
4
4
  let( :name ) { 'test' }
5
5
  let( :logger ) { Yell.new :stdout }
6
6
 
7
- subject { Yell[name] }
7
+ subject { Yell::Repository[name] }
8
8
 
9
9
 
10
10
  context ".[]" do
@@ -14,7 +14,7 @@ describe Yell::Repository do
14
14
 
15
15
  context "when assigned" do
16
16
  before do
17
- Yell[ name ] = logger
17
+ Yell::Repository[ name ] = logger
18
18
  end
19
19
 
20
20
  it { should == logger }
@@ -23,7 +23,7 @@ describe Yell::Repository do
23
23
 
24
24
  context ".[]=" do
25
25
  before do
26
- Yell[ name ] = logger
26
+ Yell::Repository[ name ] = logger
27
27
  end
28
28
 
29
29
  it { should == logger }
@@ -31,11 +31,47 @@ describe Yell::Repository do
31
31
 
32
32
  context "[]= with a named logger" do
33
33
  before do
34
- Yell[ name ] = Yell.new :stdout, :name => name
34
+ Yell::Repository[ name ] = Yell.new :stdout, :name => name
35
35
  end
36
36
 
37
37
  it { should_not be_nil }
38
38
  end
39
39
 
40
+ context "[]= with a named logger of other name" do
41
+ let( :other ) { 'other' }
42
+ let( :logger ) { Yell.new :stdout, :name => other }
43
+
44
+ before do
45
+ Yell::Repository[ name ] = logger
46
+ end
47
+
48
+ it "should add logger to both repositories" do
49
+ Yell::Repository[name].should == logger
50
+ Yell::Repository[other].should == logger
51
+ end
52
+ end
53
+
54
+ context "loggers" do
55
+ let( :loggers ) { { name => logger } }
56
+
57
+ subject { Yell::Repository.loggers }
58
+
59
+ before do
60
+ Yell::Repository[ name ] = logger
61
+ end
62
+
63
+ it { should == loggers }
64
+ end
65
+
66
+ context "clear" do
67
+ subject { Yell::Repository.loggers }
68
+
69
+ before do
70
+ Yell::Repository[ name ] = logger
71
+ Yell::Repository.clear
72
+ end
73
+
74
+ it { should be_empty }
75
+ end
40
76
  end
41
77
 
@@ -53,5 +53,13 @@ describe Yell do
53
53
  end
54
54
  end
55
55
 
56
+ context :loggers do
57
+ it "should delegate to the repository" do
58
+ mock.proxy( Yell::Repository ).loggers
59
+
60
+ Yell.loggers
61
+ end
62
+ end
63
+
56
64
  end
57
65
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.13.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-04 00:00:00.000000000 Z
12
+ date: 2012-09-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Yell - Your Extensible Logging Library. Define multiple adapters, various
15
15
  log level combinations or message formatting options like you've never done before
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  requirements: []
86
86
  rubyforge_project: yell
87
- rubygems_version: 1.8.23
87
+ rubygems_version: 1.8.24
88
88
  signing_key:
89
89
  specification_version: 3
90
90
  summary: Yell - Your Extensible Logging Library
@@ -105,4 +105,3 @@ test_files:
105
105
  - spec/yell/logger_spec.rb
106
106
  - spec/yell/repository_spec.rb
107
107
  - spec/yell_spec.rb
108
- has_rdoc: