happening 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/happening/log.rb CHANGED
@@ -21,19 +21,19 @@ module Happening
21
21
  end
22
22
 
23
23
  def self.debug(msg)
24
- logger.debug(msg)
24
+ logger.debug("Happening: #{msg}")
25
25
  end
26
26
 
27
27
  def self.info(msg)
28
- logger.info(msg)
28
+ logger.debug("Happening: #{msg}")
29
29
  end
30
30
 
31
31
  def self.warn(msg)
32
- logger.warn(msg)
32
+ logger.debug("Happening: #{msg}")
33
33
  end
34
34
 
35
35
  def self.error(msg)
36
- logger.error(msg)
36
+ logger.debug("Happening: #{msg}")
37
37
  end
38
38
 
39
39
  end
@@ -42,26 +42,26 @@ module Happening
42
42
  end
43
43
 
44
44
  def error_callback
45
- Happening::Log.error "Response #{response.response_header.status rescue ''}"
45
+ Happening::Log.error "#{http_method.to_s.upcase} #{url}: Response #{response.response_header.status rescue ''}"
46
46
  if options[:on_error].respond_to?(:call)
47
47
  call_user_error_handler
48
48
  else
49
- raise Happening::Error.new("Failed reponse! Status code was #{response.response_header.status rescue ''}")
49
+ raise Happening::Error.new("#{http_method.to_s.upcase} #{url}: Failed reponse! Status code was #{response.response_header.status rescue ''}")
50
50
  end
51
51
  end
52
52
 
53
53
  def success_callback
54
- Happening::Log.debug "Response #{response.response_header.status rescue ''}"
54
+ Happening::Log.debug "#{http_method.to_s.upcase} #{url}: Response #{response.response_header.status rescue ''}"
55
55
  case response.response_header.status
56
56
  when 0, 400, 401, 404, 403, 409, 411, 412, 416, 500, 503
57
57
  if should_retry?
58
- Happening::Log.debug "retrying after: status #{response.response_header.status rescue ''}"
58
+ Happening::Log.debug "#{http_method.to_s.upcase} #{url}: retrying after: status #{response.response_header.status rescue ''}"
59
59
  handle_retry
60
60
  else
61
61
  error_callback
62
62
  end
63
63
  when 300, 301, 303, 304, 307
64
- Happening::Log.info "being redirected_to: #{response.response_header['LOCATION'] rescue ''}"
64
+ Happening::Log.info "#{http_method.to_s.upcase} #{url}: being redirected_to: #{response.response_header['LOCATION'] rescue ''}"
65
65
  handle_redirect
66
66
  else
67
67
  call_user_success_handler
@@ -86,7 +86,7 @@ module Happening
86
86
  new_request = self.class.new(http_method, url, options.update(:retry_count => options[:retry_count] - 1 ))
87
87
  new_request.execute
88
88
  else
89
- Happening::Log.info "Re-tried too often - giving up" if Happening.debug?
89
+ Happening::Log.error "#{http_method.to_s.upcase} #{url}: Re-tried too often - giving up"
90
90
  end
91
91
  end
92
92
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: happening
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 6
9
+ version: 0.0.6
5
10
  platform: ruby
6
11
  authors:
7
12
  - Jonathan Weiss
@@ -9,29 +14,33 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-27 00:00:00 +01:00
17
+ date: 2010-04-23 00:00:00 +02:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: em-http-request
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
30
+ type: :runtime
31
+ version_requirements: *id001
25
32
  - !ruby/object:Gem::Dependency
26
33
  name: activesupport
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
33
41
  version: "0"
34
- version:
42
+ type: :runtime
43
+ version_requirements: *id002
35
44
  description: An EventMachine based S3 client - using em-http-request
36
45
  email: info@peritor.com
37
46
  executables: []
@@ -62,18 +71,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
62
71
  requirements:
63
72
  - - ">="
64
73
  - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
65
76
  version: "0"
66
- version:
67
77
  required_rubygems_version: !ruby/object:Gem::Requirement
68
78
  requirements:
69
79
  - - ">="
70
80
  - !ruby/object:Gem::Version
81
+ segments:
82
+ - 0
71
83
  version: "0"
72
- version:
73
84
  requirements: []
74
85
 
75
86
  rubyforge_project:
76
- rubygems_version: 1.3.5
87
+ rubygems_version: 1.3.6
77
88
  signing_key:
78
89
  specification_version: 3
79
90
  summary: An EventMachine based S3 client