mongodb_logger 0.2.6-jruby → 0.2.7-jruby
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/.rvmrc +1 -1
- data/.travis.yml +3 -2
- data/CHANGELOG.md +5 -0
- data/Rakefile +6 -3
- data/SUPPORTED_RAILS_VERSIONS +3 -1
- data/features/step_definitions/rails_application_steps.rb +13 -2
- data/lib/mongodb_logger/initializer_mixin.rb +4 -4
- data/lib/mongodb_logger/logger.rb +7 -6
- data/lib/mongodb_logger/version.rb +1 -1
- data/mongodb_logger.gemspec +2 -2
- data/mongodb_logger.java.gemspec +1 -1
- data/test/log/.gitkeep +0 -0
- data/test/test.sh +1 -1
- data/test/unit/mongodb_logger_test.rb +1 -1
- metadata +40 -38
data/.gitignore
CHANGED
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm ruby-1.9.3-
|
1
|
+
rvm ruby-1.9.3-p125@mongodb_logger_gems --create
|
data/.travis.yml
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
before_script:
|
2
2
|
- "sh -e /etc/init.d/xvfb start"
|
3
3
|
script: "sh -c 'export DISPLAY=:99.0 && test/test.sh'"
|
4
|
+
language: ruby
|
4
5
|
rvm:
|
5
6
|
- 1.8.7
|
6
7
|
# - ree
|
7
8
|
- 1.9.2
|
8
9
|
- 1.9.3
|
9
10
|
- ruby-head
|
10
|
-
|
11
|
-
# - jruby-
|
11
|
+
- jruby
|
12
|
+
# - jruby-head
|
12
13
|
notifications:
|
13
14
|
email: false
|
14
15
|
branches:
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -10,9 +10,8 @@ end
|
|
10
10
|
|
11
11
|
#require "bundler/gem_tasks"
|
12
12
|
require 'bundler/gem_helper'
|
13
|
-
Bundler::GemHelper.install_tasks(:name => 'mongodb_logger.java')
|
14
13
|
Bundler::GemHelper.install_tasks(:name => 'mongodb_logger')
|
15
|
-
|
14
|
+
Bundler::GemHelper.install_tasks(:name => 'mongodb_logger.java')
|
16
15
|
|
17
16
|
#########################################
|
18
17
|
### Help tasks
|
@@ -77,7 +76,11 @@ LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze
|
|
77
76
|
|
78
77
|
if ENV['CI']
|
79
78
|
# for ci testing only major rails versions
|
80
|
-
|
79
|
+
if 'java' == RUBY_PLATFORM
|
80
|
+
RAILS_VERSIONS = ['3.0.11', '3.1.3']
|
81
|
+
else
|
82
|
+
RAILS_VERSIONS = ['3.0.11', '3.1.3', '3.2.2']
|
83
|
+
end
|
81
84
|
else
|
82
85
|
RAILS_VERSIONS = IO.read('SUPPORTED_RAILS_VERSIONS').strip.split("\n")
|
83
86
|
end
|
data/SUPPORTED_RAILS_VERSIONS
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
require 'active_support/core_ext/string/inflections'
|
2
2
|
|
3
3
|
Given /^I have built and installed the "([^\"]*)" gem$/ do |gem_name|
|
4
|
-
|
4
|
+
if 'java' == RUBY_PLATFORM
|
5
|
+
@terminal.build_and_install_gem(File.join(PROJECT_ROOT, "#{gem_name}.java.gemspec"))
|
6
|
+
else
|
7
|
+
@terminal.build_and_install_gem(File.join(PROJECT_ROOT, "#{gem_name}.gemspec"))
|
8
|
+
end
|
5
9
|
end
|
6
10
|
|
7
11
|
When /^I generate a new Rails application$/ do
|
@@ -35,7 +39,14 @@ When /^I setup mongodb_logger tests$/ do
|
|
35
39
|
end
|
36
40
|
|
37
41
|
When /^I setup all gems for rails$/ do
|
38
|
-
|
42
|
+
if !rails30?
|
43
|
+
if 'java' == RUBY_PLATFORM
|
44
|
+
bundle_gem("therubyrhino", nil)
|
45
|
+
bundle_gem("jruby-openssl", nil)
|
46
|
+
else
|
47
|
+
bundle_gem("therubyracer", nil)
|
48
|
+
end
|
49
|
+
end
|
39
50
|
step %{I run "bundle install"}
|
40
51
|
@terminal.status.exitstatus.should == 0
|
41
52
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module MongodbLogger
|
2
2
|
module InitializerMixin
|
3
3
|
|
4
|
-
def
|
5
|
-
3 == Rails::VERSION::MAJOR &&
|
4
|
+
def rails3(minor = 0)
|
5
|
+
3 == Rails::VERSION::MAJOR && minor == Rails::VERSION::MINOR
|
6
6
|
end
|
7
7
|
|
8
8
|
def create_logger(config)
|
9
|
-
path =
|
9
|
+
path = rails3(0) ? config.paths.log.to_a.first : config.paths['log'].first
|
10
10
|
level = ActiveSupport::BufferedLogger.const_get(config.log_level.to_s.upcase)
|
11
11
|
logger = MongodbLogger::Logger.new(:path => path, :level => level)
|
12
|
-
logger.auto_flushing = false if Rails.env.production?
|
12
|
+
logger.auto_flushing = false if Rails.env.production? && (rails3(0) || rails3(1))
|
13
13
|
logger
|
14
14
|
rescue StandardError => e
|
15
15
|
logger = ActiveSupport::BufferedLogger.new(STDERR)
|
@@ -41,10 +41,11 @@ module MongodbLogger
|
|
41
41
|
else
|
42
42
|
raise ArgumentError, ":#{key} is a reserved key for the mongodb logger. Please choose a different key"
|
43
43
|
end
|
44
|
-
end
|
44
|
+
end if @mongo_record
|
45
45
|
end
|
46
46
|
|
47
47
|
def add(severity, message = nil, progname = nil, &block)
|
48
|
+
$stdout.puts(message) if ENV['HEROKU_RACK'] # log in stdout on Heroku
|
48
49
|
if @level && @level <= severity && message.present? && @mongo_record.present?
|
49
50
|
# do not modify the original message used by the buffered logger
|
50
51
|
msg = logging_colorized? ? message.to_s.gsub(/(\e(\[([\d;]*[mz]?))?)?/, '').strip : message
|
@@ -71,7 +72,7 @@ module MongodbLogger
|
|
71
72
|
|
72
73
|
runtime = Benchmark.measure{ yield }.real if block_given?
|
73
74
|
rescue Exception => e
|
74
|
-
add(3, e.message + "\n" + e.backtrace.join("\n"))
|
75
|
+
add(3, e.message.to_s + "\n" + e.backtrace.join("\n"))
|
75
76
|
# log exceptions
|
76
77
|
@mongo_record[:is_exception] = true
|
77
78
|
# Reraise the exception for anyone else who cares
|
@@ -105,7 +106,7 @@ module MongodbLogger
|
|
105
106
|
connect
|
106
107
|
check_for_collection
|
107
108
|
end
|
108
|
-
|
109
|
+
|
109
110
|
def disable_file_logging?
|
110
111
|
@db_configuration.fetch('disable_file_logging', false)
|
111
112
|
end
|
@@ -149,7 +150,7 @@ module MongodbLogger
|
|
149
150
|
|
150
151
|
def mongo_connection_object
|
151
152
|
if @db_configuration['hosts']
|
152
|
-
conn = Mongo::ReplSetConnection.new(*(@db_configuration['hosts'] <<
|
153
|
+
conn = Mongo::ReplSetConnection.new(*(@db_configuration['hosts'] <<
|
153
154
|
{:auto_reconnect => true, :pool_timeout => 6}))
|
154
155
|
@db_configuration['replica_set'] = true
|
155
156
|
else
|
@@ -190,7 +191,7 @@ module MongodbLogger
|
|
190
191
|
# Cache it since these ActiveRecord attributes are assigned after logger initialization occurs in Rails boot
|
191
192
|
@colorized ||= Object.const_defined?(:ActiveRecord) && ActiveRecord::LogSubscriber.colorize_logging
|
192
193
|
end
|
193
|
-
|
194
|
+
|
194
195
|
# try to serialyze data by each key and found invalid object
|
195
196
|
def nice_serialize(rec)
|
196
197
|
if msgs = rec[:messages]
|
@@ -204,7 +205,7 @@ module MongodbLogger
|
|
204
205
|
end
|
205
206
|
end
|
206
207
|
end
|
207
|
-
|
208
|
+
|
208
209
|
def nice_serialize_object(data)
|
209
210
|
case data
|
210
211
|
when NilClass, String, Fixnum, Bignum, Float, TrueClass, FalseClass, Time, Regexp, Symbol
|
data/mongodb_logger.gemspec
CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_development_dependency "therubyracer", ">= 0.9.9"
|
23
23
|
|
24
24
|
gem.add_runtime_dependency "rake", "~> 0.9.0"
|
25
|
-
gem.add_runtime_dependency "mongo", "~> 1.
|
26
|
-
gem.add_runtime_dependency "bson_ext", "~> 1.
|
25
|
+
gem.add_runtime_dependency "mongo", "~> 1.6.1"
|
26
|
+
gem.add_runtime_dependency "bson_ext", "~> 1.6.1"
|
27
27
|
gem.add_runtime_dependency "i18n", ">= 0.4.1"
|
28
28
|
gem.add_runtime_dependency "json", "~> 1.6.1"
|
29
29
|
gem.add_runtime_dependency "activesupport", ">= 3.0.0"
|
data/mongodb_logger.java.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_development_dependency "uglifier", ">= 1.2.0"
|
22
22
|
|
23
23
|
gem.add_runtime_dependency "rake", "~> 0.9.0"
|
24
|
-
gem.add_runtime_dependency "mongo", "~> 1.
|
24
|
+
gem.add_runtime_dependency "mongo", "~> 1.6.1"
|
25
25
|
gem.add_runtime_dependency "i18n", ">= 0.4.1"
|
26
26
|
gem.add_runtime_dependency "json", "~> 1.6.1"
|
27
27
|
gem.add_runtime_dependency "activesupport", ">= 3.0.0"
|
data/test/log/.gitkeep
ADDED
File without changes
|
data/test/test.sh
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongodb_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: jruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jasmine
|
16
|
-
requirement: &
|
16
|
+
requirement: &70285483189080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70285483189080
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70285483188340 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.8.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70285483188340
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: shoulda
|
38
|
-
requirement: &
|
38
|
+
requirement: &70285483187580 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70285483187580
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mocha
|
49
|
-
requirement: &
|
49
|
+
requirement: &70285483186840 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.10.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70285483186840
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: cucumber
|
60
|
-
requirement: &
|
60
|
+
requirement: &70285483186180 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.1.2
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70285483186180
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: capybara
|
71
|
-
requirement: &
|
71
|
+
requirement: &70285483185520 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.1.2
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70285483185520
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: coffee-script
|
82
|
-
requirement: &
|
82
|
+
requirement: &70285483184740 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 2.2.0
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70285483184740
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: uglifier
|
93
|
-
requirement: &
|
93
|
+
requirement: &70285483184040 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 1.2.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70285483184040
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rake
|
104
|
-
requirement: &
|
104
|
+
requirement: &70285483183340 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,21 +109,21 @@ dependencies:
|
|
109
109
|
version: 0.9.0
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70285483183340
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: mongo
|
115
|
-
requirement: &
|
115
|
+
requirement: &70285483182840 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: 1.
|
120
|
+
version: 1.6.1
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70285483182840
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: i18n
|
126
|
-
requirement: &
|
126
|
+
requirement: &70285483182300 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: 0.4.1
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70285483182300
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: json
|
137
|
-
requirement: &
|
137
|
+
requirement: &70285483181660 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: 1.6.1
|
143
143
|
type: :runtime
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70285483181660
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: activesupport
|
148
|
-
requirement: &
|
148
|
+
requirement: &70285483205260 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,10 +153,10 @@ dependencies:
|
|
153
153
|
version: 3.0.0
|
154
154
|
type: :runtime
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *70285483205260
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: actionpack
|
159
|
-
requirement: &
|
159
|
+
requirement: &70285483204440 !ruby/object:Gem::Requirement
|
160
160
|
none: false
|
161
161
|
requirements:
|
162
162
|
- - ! '>='
|
@@ -164,10 +164,10 @@ dependencies:
|
|
164
164
|
version: 3.0.0
|
165
165
|
type: :runtime
|
166
166
|
prerelease: false
|
167
|
-
version_requirements: *
|
167
|
+
version_requirements: *70285483204440
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: sinatra
|
170
|
-
requirement: &
|
170
|
+
requirement: &70285483203280 !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|
173
173
|
- - ! '>='
|
@@ -175,10 +175,10 @@ dependencies:
|
|
175
175
|
version: 1.2.0
|
176
176
|
type: :runtime
|
177
177
|
prerelease: false
|
178
|
-
version_requirements: *
|
178
|
+
version_requirements: *70285483203280
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
180
|
name: erubis
|
181
|
-
requirement: &
|
181
|
+
requirement: &70285483201800 !ruby/object:Gem::Requirement
|
182
182
|
none: false
|
183
183
|
requirements:
|
184
184
|
- - ! '>='
|
@@ -186,10 +186,10 @@ dependencies:
|
|
186
186
|
version: 2.6.6
|
187
187
|
type: :runtime
|
188
188
|
prerelease: false
|
189
|
-
version_requirements: *
|
189
|
+
version_requirements: *70285483201800
|
190
190
|
- !ruby/object:Gem::Dependency
|
191
191
|
name: vegas
|
192
|
-
requirement: &
|
192
|
+
requirement: &70285483201020 !ruby/object:Gem::Requirement
|
193
193
|
none: false
|
194
194
|
requirements:
|
195
195
|
- - ~>
|
@@ -197,7 +197,7 @@ dependencies:
|
|
197
197
|
version: 0.1.2
|
198
198
|
type: :runtime
|
199
199
|
prerelease: false
|
200
|
-
version_requirements: *
|
200
|
+
version_requirements: *70285483201020
|
201
201
|
description: MongoDB logger for Rails 3
|
202
202
|
email:
|
203
203
|
- leopard.not.a@gmail.com
|
@@ -316,6 +316,7 @@ files:
|
|
316
316
|
- test/config/samples/mongodb_logger.yml
|
317
317
|
- test/config/samples/mongoid.yml
|
318
318
|
- test/config/samples/server_config.yml
|
319
|
+
- test/log/.gitkeep
|
319
320
|
- test/rails.rb
|
320
321
|
- test/rails/app/controllers/order_controller.rb
|
321
322
|
- test/rails/test/functional/order_controller_test.rb
|
@@ -346,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
346
347
|
version: '0'
|
347
348
|
requirements: []
|
348
349
|
rubyforge_project: mongodb_logger
|
349
|
-
rubygems_version: 1.8.
|
350
|
+
rubygems_version: 1.8.16
|
350
351
|
signing_key:
|
351
352
|
specification_version: 3
|
352
353
|
summary: MongoDB logger for Rails 3
|
@@ -372,6 +373,7 @@ test_files:
|
|
372
373
|
- test/config/samples/mongodb_logger.yml
|
373
374
|
- test/config/samples/mongoid.yml
|
374
375
|
- test/config/samples/server_config.yml
|
376
|
+
- test/log/.gitkeep
|
375
377
|
- test/rails.rb
|
376
378
|
- test/rails/app/controllers/order_controller.rb
|
377
379
|
- test/rails/test/functional/order_controller_test.rb
|