http_logger 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -38,12 +38,3 @@ end
38
38
 
39
39
  task :default => :spec
40
40
 
41
- require 'rake/rdoctask'
42
- Rake::RDocTask.new do |rdoc|
43
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
-
45
- rdoc.rdoc_dir = 'rdoc'
46
- rdoc.title = "http_logger #{version}"
47
- rdoc.rdoc_files.include('README*')
48
- rdoc.rdoc_files.include('lib/**/*.rb')
49
- end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
data/http_logger.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "http_logger"
8
- s.version = "0.2.3"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bogdan Gusiev"]
12
- s.date = "2012-09-14"
12
+ s.date = "2012-12-27"
13
13
  s.description = "This gem keep an eye on every Net::HTTP library usage and dump all request and response data to the log file"
14
14
  s.email = "agresso@gmail.com"
15
15
  s.extra_rdoc_files = [
data/lib/http_logger.rb CHANGED
@@ -45,7 +45,7 @@ class Net::HTTP
45
45
  log("#{request.class.to_s.upcase} params", request.body)
46
46
  end
47
47
  if defined?(response) && response
48
- log("Response status", "#{response.class} (#{response.code})")
48
+ log("Response status", "#{response.class} (#{response.code})")
49
49
  response.each_capitalized { |k,v| log("HTTP response header", "#{k}: #{v}") } if self.class.log_headers
50
50
  body = response.body
51
51
  log("Response body", body) unless body.is_a?(Net::ReadAdapter)
@@ -89,8 +89,17 @@ end
89
89
 
90
90
 
91
91
  if defined?(Rails)
92
- Rails.configuration.after_initialize do
93
- Net::HTTP.logger = Rails.logger
92
+
93
+ if !Rails.application.nil? && !Rails.application.config.nil?
94
+ # Rails2
95
+ Rails.configuration.after_initialize do
96
+ Net::HTTP.logger = Rails.logger
97
+ end
98
+ elsif defined?(ActiveSupport) && ActiveSupport.respond_to?(:on_load)
99
+ # Rails3
100
+ ActiveSupport.on_load(:after_initialize) do
101
+ Net::HTTP.logger = Rails.logger
102
+ end
94
103
  end
95
104
  end
96
105
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
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-14 00:00:00.000000000 Z
12
+ date: 2012-12-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  segments:
115
115
  - 0
116
- hash: -2871056333341494518
116
+ hash: 4446860932406497157
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements: