ratchetio 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ **0.6.1**
4
+ - Added a log message containing a link to the instance. Copy-paste the link into your browser to view its details in Ratchet.
5
+ - Ratchetio.report_message now returns 'ignored' or 'error' instead of nil when a message is not reported for one of those reasons, for consistency with Ratchetio.report_exception.
6
+
3
7
  **0.6.0**
4
- - BREAKING CHANGE: Ratchetio.report_exception now returns 'ignored', 'disabled', or 'error' instead of nil when the exception is not reported for one of those reasons. It still returns the payload upon success.
8
+ - POSSIBLE BREAKING CHANGE: Ratchetio.report_exception now returns 'ignored', 'disabled', or 'error' instead of nil when the exception is not reported for one of those reasons. It still returns the payload upon success.
5
9
  - Request data is now parsed from the rack environment instead of from within the controller, addressing issue #10.
6
10
  - Add Sidekiq middleware for catching workers' exceptions
7
11
  - Replaced activesupport dependency with multi_json
@@ -4,14 +4,14 @@ module Ratchetio
4
4
  class Configuration
5
5
 
6
6
  attr_accessor :access_token
7
+ attr_accessor :async_handler
7
8
  attr_accessor :branch
8
9
  attr_accessor :default_logger
9
10
  attr_accessor :enabled
10
11
  attr_accessor :endpoint
11
- attr_accessor :write_to_file
12
- attr_accessor :filepath
13
12
  attr_accessor :environment
14
13
  attr_accessor :exception_level_filters
14
+ attr_accessor :filepath
15
15
  attr_accessor :framework
16
16
  attr_accessor :logger
17
17
  attr_accessor :person_method
@@ -21,21 +21,23 @@ module Ratchetio
21
21
  attr_accessor :root
22
22
  attr_accessor :scrub_fields
23
23
  attr_accessor :use_async
24
- attr_accessor :async_handler
24
+ attr_accessor :web_base
25
+ attr_accessor :write_to_file
25
26
 
26
27
  DEFAULT_ENDPOINT = 'https://submit.ratchet.io/api/1/item/'
28
+ DEFAULT_WEB_BASE = 'https://ratchet.io'
27
29
 
28
30
  def initialize
31
+ @async_handler = nil
29
32
  @default_logger = lambda { Logger.new(STDERR) }
30
33
  @enabled = true
31
34
  @endpoint = DEFAULT_ENDPOINT
32
- @write_to_file = false
33
- @framework = 'Plain'
34
35
  @exception_level_filters = {
35
36
  'ActiveRecord::RecordNotFound' => 'warning',
36
37
  'AbstractController::ActionNotFound' => 'warning',
37
38
  'ActionController::RoutingError' => 'warning'
38
39
  }
40
+ @framework = 'Plain'
39
41
  @person_method = 'current_user'
40
42
  @person_id_method = 'id'
41
43
  @person_username_method = 'username'
@@ -43,7 +45,8 @@ module Ratchetio
43
45
  @scrub_fields = [:passwd, :password, :password_confirmation, :secret,
44
46
  :confirm_password, :password_confirmation]
45
47
  @use_async = false
46
- @async_handler = nil
48
+ @web_base = DEFAULT_WEB_BASE
49
+ @write_to_file = false
47
50
  end
48
51
 
49
52
  # allow params to be read like a hash
@@ -1,3 +1,3 @@
1
1
  module Ratchetio
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
data/lib/ratchetio.rb CHANGED
@@ -74,6 +74,7 @@ module Ratchetio
74
74
 
75
75
  payload = build_payload(data)
76
76
  schedule_payload(payload)
77
+ log_instance_link(data)
77
78
  data
78
79
  rescue => e
79
80
  logger.error "[Ratchet.io] Error reporting exception to Ratchet.io: #{e}"
@@ -92,15 +93,16 @@ module Ratchetio
92
93
  # @param extra_data [Hash] Additional data to include alongside the body. Don't use 'body' as
93
94
  # it is reserved.
94
95
  def report_message(message, level = 'info', extra_data = {})
95
- unless configuration.enabled
96
- return
97
- end
96
+ return 'disabled' unless configuration.enabled
98
97
 
99
98
  data = message_data(message, level, extra_data)
100
99
  payload = build_payload(data)
101
100
  schedule_payload(payload)
101
+ log_instance_link(data)
102
+ data
102
103
  rescue => e
103
104
  logger.error "[Ratchet.io] Error reporting message to Ratchet.io: #{e}"
105
+ 'error'
104
106
  end
105
107
 
106
108
  # Turns off reporting for the given block.
@@ -132,6 +134,10 @@ module Ratchetio
132
134
 
133
135
  private
134
136
 
137
+ def log_instance_link(data)
138
+ logger.info "[Ratchet.io] Details: #{configuration.web_base}/instance/uuid?uuid=#{data[:uuid]}"
139
+ end
140
+
135
141
  def ignored?(exception)
136
142
  if filtered_level(exception) == 'ignore'
137
143
  return true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratchetio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
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: 2013-01-29 00:00:00.000000000 Z
12
+ date: 2013-02-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -278,4 +278,3 @@ test_files:
278
278
  - spec/requests/home_spec.rb
279
279
  - spec/spec_helper.rb
280
280
  - spec/support/devise.rb
281
- has_rdoc: