bunyan 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -2
- data/README.md +2 -1
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/bunyan.gemspec +8 -8
- data/lib/bunyan.rb +5 -2
- data/lib/bunyan/config.rb +4 -0
- data/spec/bunyan_spec.rb +6 -4
- data/spec/config_spec.rb +20 -0
- metadata +10 -8
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
Version 0.2.2
|
2
|
+
=============
|
3
|
+
* No longer pass messages to the collection if a Mongo connection could not be established
|
4
|
+
* Bunyan now uses the new bson_ext c extension, per version 0.20.0 of the ruby driver
|
5
|
+
|
1
6
|
Version 0.2.1
|
2
7
|
=============
|
3
8
|
* Bunyan now fails silently when a connection error occurs
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -56,7 +56,8 @@ More
|
|
56
56
|
|
57
57
|
TODO
|
58
58
|
====
|
59
|
-
* Fail silently if no mongo server running
|
59
|
+
* <del>Fail silently if no mongo server running</del>
|
60
60
|
* Ability to limit bunyan to only run in certain environments
|
61
61
|
* Add middleware client for easy drop-in to rails/rack apps
|
62
|
+
* Add ability to connect to a remote mongo server
|
62
63
|
* <del>Ability to configure size of capped collection</del>
|
data/Rakefile
CHANGED
@@ -7,8 +7,8 @@ begin
|
|
7
7
|
gemspec.email = "ajsharp@gmail.com"
|
8
8
|
gemspec.homepage = "http://github.com/ajsharp/bunyan"
|
9
9
|
gemspec.authors = ["Alex Sharp"]
|
10
|
-
gemspec.add_dependency 'mongo', '>= 0.
|
11
|
-
gemspec.add_dependency '
|
10
|
+
gemspec.add_dependency 'mongo', '>= 0.20.1'
|
11
|
+
gemspec.add_dependency 'bson_ext', '>= 0.20.1'
|
12
12
|
end
|
13
13
|
Jeweler::GemcutterTasks.new
|
14
14
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/bunyan.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bunyan}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alex Sharp"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-10}
|
13
13
|
s.description = %q{Bunyan is a thin ruby wrapper around a MongoDB capped collection, created with high-performance, flexible logging in mind.}
|
14
14
|
s.email = %q{ajsharp@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -48,15 +48,15 @@ Gem::Specification.new do |s|
|
|
48
48
|
s.specification_version = 3
|
49
49
|
|
50
50
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
|
-
s.add_runtime_dependency(%q<mongo>, [">= 0.
|
52
|
-
s.add_runtime_dependency(%q<
|
51
|
+
s.add_runtime_dependency(%q<mongo>, [">= 0.20.1"])
|
52
|
+
s.add_runtime_dependency(%q<bson_ext>, [">= 0.20.1"])
|
53
53
|
else
|
54
|
-
s.add_dependency(%q<mongo>, [">= 0.
|
55
|
-
s.add_dependency(%q<
|
54
|
+
s.add_dependency(%q<mongo>, [">= 0.20.1"])
|
55
|
+
s.add_dependency(%q<bson_ext>, [">= 0.20.1"])
|
56
56
|
end
|
57
57
|
else
|
58
|
-
s.add_dependency(%q<mongo>, [">= 0.
|
59
|
-
s.add_dependency(%q<
|
58
|
+
s.add_dependency(%q<mongo>, [">= 0.20.1"])
|
59
|
+
s.add_dependency(%q<bson_ext>, [">= 0.20.1"])
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
data/lib/bunyan.rb
CHANGED
@@ -38,7 +38,8 @@ module Bunyan
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def disabled?
|
41
|
-
|
41
|
+
# @TODO: Refactor this. Yuck.
|
42
|
+
config.nil? || (!config.nil? && config.disabled?)
|
42
43
|
end
|
43
44
|
|
44
45
|
def method_missing(method, *args, &block)
|
@@ -61,7 +62,9 @@ module Bunyan
|
|
61
62
|
@connection = @db.connection
|
62
63
|
@collection = retrieve_or_initialize_collection(config.collection)
|
63
64
|
rescue Mongo::ConnectionFailure => ex
|
64
|
-
@
|
65
|
+
# @TODO: I don't like how I'm overloading @config.disabled
|
66
|
+
# for user disabling and error disabling
|
67
|
+
@config.disabled = true
|
65
68
|
$stderr.puts 'An error occured trying to connect to MongoDB!'
|
66
69
|
end
|
67
70
|
end
|
data/lib/bunyan/config.rb
CHANGED
data/spec/bunyan_spec.rb
CHANGED
@@ -46,7 +46,7 @@ describe 'when a mongod instance is not running' do
|
|
46
46
|
c.database 'doesnt_matter'
|
47
47
|
c.collection 'b/c mongod isnt running'
|
48
48
|
end
|
49
|
-
Bunyan::Logger.
|
49
|
+
Bunyan::Logger.should be_disabled
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -138,11 +138,12 @@ describe 'when bunyan is disabled' do
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
+
# @NOTE: Some of these tests rely on other tests not modifying the mongo
|
142
|
+
# config object. This is not good, though much harder to achieve per-example
|
143
|
+
# independence when testing a singleton object.
|
141
144
|
describe 'when bunyan is not configured' do
|
142
145
|
it 'should not try to send messages to mongo' do
|
143
|
-
Bunyan::Logger.instance.stub!(:
|
144
|
-
Bunyan::Logger.should_not be_configured
|
145
|
-
Bunyan::Logger.should_not be_disabled
|
146
|
+
Bunyan::Logger.instance.stub!(:config).and_return(nil)
|
146
147
|
%w(insert count find).each do |command|
|
147
148
|
Bunyan::Logger.collection.should_not_receive(command)
|
148
149
|
Bunyan::Logger.send command
|
@@ -150,3 +151,4 @@ describe 'when bunyan is not configured' do
|
|
150
151
|
end
|
151
152
|
end
|
152
153
|
|
154
|
+
|
data/spec/config_spec.rb
CHANGED
@@ -96,3 +96,23 @@ describe 'bunyan logger configuration' do
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
+
describe Bunyan::Logger::Config, "#disabled?" do
|
100
|
+
before :each do
|
101
|
+
@config = Bunyan::Logger::Config.new
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should be false if @disabled is nil' do
|
105
|
+
@config.disabled = nil
|
106
|
+
@config.should_not be_disabled
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'should be true if @disabled is true' do
|
110
|
+
@config.disabled = true
|
111
|
+
@config.should be_disabled
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'should be false if @isabled is false' do
|
115
|
+
@config.disabled = false
|
116
|
+
@config.should_not be_disabled
|
117
|
+
end
|
118
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alex Sharp
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-10 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,13 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
28
|
- 0
|
29
|
-
-
|
30
|
-
|
29
|
+
- 20
|
30
|
+
- 1
|
31
|
+
version: 0.20.1
|
31
32
|
type: :runtime
|
32
33
|
version_requirements: *id001
|
33
34
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
35
|
+
name: bson_ext
|
35
36
|
prerelease: false
|
36
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
@@ -39,8 +40,9 @@ dependencies:
|
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
segments:
|
41
42
|
- 0
|
42
|
-
-
|
43
|
-
|
43
|
+
- 20
|
44
|
+
- 1
|
45
|
+
version: 0.20.1
|
44
46
|
type: :runtime
|
45
47
|
version_requirements: *id002
|
46
48
|
description: Bunyan is a thin ruby wrapper around a MongoDB capped collection, created with high-performance, flexible logging in mind.
|