mongodb_logger 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72c133a8099b4733c9a404e682041a9875ddcdfd
4
- data.tar.gz: 6c530544dab94d2856bf50deeecb6d3182677331
3
+ metadata.gz: 8ae987b579d29c9e088ea907aa2679494a1df53c
4
+ data.tar.gz: a63a152e8ccf5ee8711bfcdfa199b95c9d59ad4c
5
5
  SHA512:
6
- metadata.gz: cd165abcf990a99274728da38476946ae5dc60f73fa98bb71755457ecdfd7797d583962b34cf7b8ce6dccf56c697d9d851b3f5cb110ae330a2fabac26641de35
7
- data.tar.gz: 5bcdf32245c3281e476f95b410cca8b5d8e25f20ccbe311bb4f3b55727a097ef1f7e9525290df464caf53e509e541b2ee7a2d7e72474fd3fa5a7df58193e46e3
6
+ metadata.gz: b165d24c972e92d8f9924c979b2ca58d888bfd5f23ea229b60f1c2007df80f959e872eb51d518e210a1f577d60f05ac59e2ed5191254100644698df46a5e2126
7
+ data.tar.gz: 66224465afd039b229111975c3199c79536df085dd0a56bc94e9835f08363448425c4dadb3e7d29c31e838119f6598e253e5b7ebc5a3a376260227aeed3fee54
data/Appraisals CHANGED
@@ -1,10 +1,10 @@
1
1
  appraise "rails31" do
2
- gem "rails", "~> 3.1.11"
2
+ gem "rails", "~> 3.1.12"
3
3
  gem "mongodb_logger", :path => "../"
4
4
  end
5
5
 
6
6
  appraise "rails32" do
7
- gem "rails", "~> 3.2.12"
7
+ gem "rails", "~> 3.2.14"
8
8
  gem "mongodb_logger", :path => "../"
9
9
  end
10
10
 
@@ -1,5 +1,7 @@
1
1
  ## master
2
2
 
3
+ * Disable gem by option disable = false.
4
+
3
5
  ## 0.6.1
4
6
 
5
7
  * Fix problem with store sessions
data/README.md CHANGED
@@ -37,11 +37,13 @@ Doesn't support the Rails version below 3.
37
37
 
38
38
  include MongodbLogger::Base
39
39
 
40
- 1. For use with Heroku you need to prevent the rails\_log\_stdout plugin from being added by Heroku:
40
+ 1. For use with Heroku you need to prevent the rails\_log\_stdout plugin from being added by Heroku for rails 3:
41
41
 
42
42
  mkdir vendor/plugins/rails_log_stdout
43
43
  touch vendor/plugins/rails_log_stdout/.gitkeep
44
44
 
45
+ For Rails 4 just remove from Gemfile "rails_12factor" rubygem.
46
+
45
47
  1. Add MongodbLogger settings to database.yml for each environment in which you want to use the MongodbLogger. The MongodbLogger will also
46
48
  look for a separate mongodb\_logger.yml or mongoid.yml (if you are using mongoid) before looking in database.yml.
47
49
  In the mongodb\_logger.yml and mongoid.yml case, the settings should be defined without the 'mongodb\_logger' subkey.
@@ -158,6 +160,18 @@ For send email or do something on exception you can add callback:
158
160
 
159
161
  In this callback send record without "\_id", because logger not wait for insert response from MongoDB.
160
162
 
163
+ ## Disable mongodb_logger
164
+
165
+ To disable MongodbLogger you can use option disable. But this should be set before rails load (for example in Rails app the top of "config/application.rb"):
166
+
167
+ MongodbLogger::Base.configure do |config|
168
+ config.disable = true
169
+ end
170
+
171
+ or
172
+
173
+ MongodbLogger::Base.disable = true
174
+
161
175
  ## Migrate to another size of capped collection
162
176
 
163
177
  If you need change capper collection size, you should change the "capsize" key in mongodb\_config and run this task for migration:
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "~> 3.1.11"
5
+ gem "rails", "~> 3.1.12"
6
6
  gem "mongodb_logger", :path=>"../"
7
7
 
8
8
  gemspec :path=>"../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "~> 3.2.12"
5
+ gem "rails", "~> 3.2.14"
6
6
  gem "mongodb_logger", :path=>"../"
7
7
 
8
8
  gemspec :path=>"../"
@@ -2,19 +2,20 @@ module MongodbLogger
2
2
  # Change config options in an initializer:
3
3
  #
4
4
  # MongodbLogger::Base.on_log_exception do |mongo_record|
5
- # ... call some code ...
5
+ # ... call some code ...
6
6
  # end
7
7
  #
8
8
  # Or in a block:
9
9
  #
10
10
  # MongodbLogger::Base.configure do |config|
11
11
  # config.on_log_exception do |mongo_record|
12
- # ... call some code ...
12
+ # ... call some code ...
13
13
  # end
14
14
  # end
15
15
 
16
16
  module Config
17
- attr_accessor :on_log_exception
17
+ extend self
18
+ attr_writer :on_log_exception, :disabled
18
19
 
19
20
  def configure
20
21
  yield self
@@ -25,8 +26,12 @@ module MongodbLogger
25
26
  @on_log_exception = block
26
27
  elsif @on_log_exception
27
28
  @on_log_exception.call(*args)
28
- end
29
+ end
29
30
  end
30
-
31
+
32
+ def disabled
33
+ @disabled ||= false
34
+ end
35
+
31
36
  end
32
37
  end
@@ -4,7 +4,7 @@ module MongodbLogger
4
4
  include MongodbLogger::InitializerMixin
5
5
 
6
6
  initializer :initialize_mongodb_logger, before: :initialize_logger do
7
- Rails.logger = config.logger = create_logger(Rails.application.config)
7
+ Rails.logger = config.logger = create_logger(Rails.application.config) unless MongodbLogger::Base.disabled
8
8
  end
9
9
 
10
10
  rake_tasks do
@@ -1,3 +1,3 @@
1
1
  module MongodbLogger
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
@@ -192,24 +192,26 @@ describe MongodbLogger::Logger do
192
192
  end
193
193
 
194
194
  context "after configure" do
195
- before do
196
- MongodbLogger::Base.configure do |config|
197
- config.on_log_exception do |mongo_record|
198
- # do something with error
195
+ context "#on_log_exception" do
196
+ before do
197
+ MongodbLogger::Base.configure do |config|
198
+ config.on_log_exception do |mongo_record|
199
+ # do something with error
200
+ end
199
201
  end
202
+ common_mongodb_logger_setup
200
203
  end
201
- common_mongodb_logger_setup
202
- end
203
204
 
204
- it "not call callback function on log" do
205
- MongodbLogger::Base.should_receive(:on_log_exception).exactly(0)
206
- log_to_mongo("Test")
207
- end
205
+ it "not call callback function on log" do
206
+ MongodbLogger::Base.should_receive(:on_log_exception).exactly(0)
207
+ log_to_mongo("Test")
208
+ end
208
209
 
209
- context "when an exception is raised" do
210
- it "should call callback function" do
211
- MongodbLogger::Base.should_receive(:on_log_exception).exactly(1)
212
- expect { log_exception_to_mongo(EXCEPTION_MSG) }.to raise_error RuntimeError, EXCEPTION_MSG
210
+ context "when an exception is raised" do
211
+ it "should call callback function" do
212
+ MongodbLogger::Base.should_receive(:on_log_exception).exactly(1)
213
+ expect { log_exception_to_mongo(EXCEPTION_MSG) }.to raise_error RuntimeError, EXCEPTION_MSG
214
+ end
213
215
  end
214
216
  end
215
217
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongodb_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Vasiliev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-03 00:00:00.000000000 Z
11
+ date: 2013-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec