logster 0.8.4.8.pre → 0.9.9

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: 97dfd5d5c1a3b852d2e795946477ebacac564a69
4
- data.tar.gz: ca14f6b9facad0859f6597340fdd9aaa88b108b4
3
+ metadata.gz: 1b6667903d7ea941ef28292bc3e3344e399e1b35
4
+ data.tar.gz: 024bdf71269ded5bfe341455d5451d0357631796
5
5
  SHA512:
6
- metadata.gz: 88eb64ef943e78d291d697ffc0eba5ede288b7b16112d02cfb7095c5b3d0eb6f3fc7a1adc2ff1ea50db47799be8ef97065192d69630e19c1fd1d3987872ef34b
7
- data.tar.gz: 9f16529049cd7a374722a3d94d9c3037201dc69e16692b6be861fe460aa2f15bc57bf5b6e3e23cf4528f34d1014d1ad80450e89836a4b712a5360984a2d2faf8
6
+ metadata.gz: 08fae884b5a23abd1291f42e4d05e1ceecdbab9a5d0ab5049c3a4ca88ee18488497f3be6fe7f26bae672f66b1fa1eb94d35dd065107105c08f1305e379c03aab
7
+ data.tar.gz: e0224e2901ff506330d5fe547ae8c2206ceccc52e1d9a15ee1c593368cfc36fc7b7ac6892747bb83dc9a938fa9b2c6e3d03d107202f03f7cb604649c89b8e53c
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
- # Logster
1
+ ![logster logo](https://raw.githubusercontent.com/discourse/logster/master/assets/images/logster-logo.png)
2
2
 
3
- A web log viewer and logging framework for Rack applications
3
+ Logster is an embedded Ruby "exception reporting service" admins can view on live websites, at `http://example.com/logs`
4
4
 
5
- ## [Live Demo](http://logster.info/logs)
5
+ ## Interface
6
6
 
7
- ![logster](http://i.imgur.com/cvfcQpv.png)
7
+ ![Screenshot](https://raw.githubusercontent.com/discourse/logster/master/assets/images/logster-screenshot.png)
8
+
9
+ Play with a live demo at [logster.info/logs](http://logster.info/logs).
8
10
 
9
11
  ## Installation
10
12
 
@@ -34,13 +36,12 @@ Logster.set_environments([:development, :staging, :production])
34
36
  ```
35
37
 
36
38
  ### Note
37
- If you are seeing error
38
- 'No such middleware to insert before: ActionDispatch::DebugExceptions' after installing logster,
39
- then you are using a conflicting gem like better_errors.
39
+ If you are seeing the error `No such middleware to insert before: ActionDispatch::DebugExceptions` after installing logster,
40
+ then you are using a conflicting gem like `better_errors`.
40
41
 
41
42
  To avoid this error, make sure logster is added behind those conflicting gems in your Gemfile.
42
43
 
43
- ### mount using warden (devise)
44
+ ### Mount using warden (devise)
44
45
  ```
45
46
  admin_constraint = lambda do |request|
46
47
  request.env['warden'].authenticate? and request.env['warden'].user.admin?
@@ -57,13 +58,6 @@ Out of the box, logster will use the default redis connection, to customise, in
57
58
  Logster.store = Logster::RedisStore.new(redis_connection)
58
59
  ```
59
60
 
60
- ## Usage
61
-
62
- The concept is to have an embedded "exception reporting service" admins can view on live sites.
63
-
64
- Logs will be visible by default at `http://sitename.com/logs`
65
-
66
-
67
61
  ## Thanks
68
62
 
69
63
  Logster UI is built using [Ember.js](http://emberjs.com/)
@@ -78,53 +72,87 @@ Logster UI is built using [Ember.js](http://emberjs.com/)
78
72
 
79
73
  # CHANGELOG
80
74
 
81
- - 2014-05-07: Started changelog :)
82
- - 2014-05-07: Version 0.0.4
83
- - Feature: Ability to ignore patterns with Logster.store.ignore = [/regex/]
84
- - Feature: Store backtraces, allow people to view them in the GUI
85
- - 2014-05-12: Version 0.0.5
86
- - Feature: We now log basic rack environment with the messages
87
- - Add your own with Logster.add_to_env(env, key, value)
88
- - 2014-05-12: Version 0.0.6
89
- - Add referer to env
90
- - 2014-05-13: Version 0.0.7
91
- - Add support for javascript exception logging
92
- - 2014-05-13: Version 0.0.8
93
- - Fix pacakging binstubs by mistake
94
- - 2014-05-13: Version 0.0.9
95
- - Stray debugger message removed, add window.location logging to js
96
- - 2014-05-24: Version 0.0.10
97
- - Correct context for error reporting
98
- - Clean up backtraces of reported exceptions
99
- - Report params in env tab
100
- - 2014-07-04: Version 0.0.12
101
- - Feature: Able to share logs, at /logs/show/(hexdigits)
102
- - Add protecting logs, so they aren't deleted when old (for use with sharing)
103
- - Restructured Redis data model
75
+ - 2015-08-18: Version 0.9.9
76
+ - This marks the largest release of Logster to date, it has been in production use for quite a while, hence the version bump.
77
+ - Feature: automatically group errors in production mode, can be manually controlled via Logster.config.allow_grouping
78
+ - Feature: automatically track application version, can be manually controlled via Logster.config.application_version
79
+ - Feature: Font Awesome icons used throughout
80
+ - Feature: Ember upgrade to 1.13
81
+ - Feature: you can now "solve" a class of errors, if error has an application_version and backtrace. Once an error is solved it will no longer be reported for the "solved" application_versions
82
+ - Feature: allow users to delete a single error
83
+ - UX: use table for env
84
+ - Feature: display "protected" state of message in list
85
+ - Feature: use local times as opposed to relative times in time column
86
+ - UX: use Google Roboto font as opposed to system fonts
87
+ - UX: remove pointless titles from log table
88
+ - Feature: If Logster is in a background tab only poll once every 60 seconds (as opposed to 3)
89
+ - Fix: protect/unprotect redirected to show page
90
+
91
+ - 2015-06-16: Version 0.8.3
92
+ - Chained loggers now respect chain ignore
93
+ - Add hostname and process_id to env on all messages
94
+
95
+ - 2015-06-10: Version 0.8.2
96
+ - Add hostname and process_id to env on all messages
97
+
98
+ - 2015-05-01: Version 0.8.1
99
+ - Don't crash out logging routine if redis is down or stderr is closed
100
+
101
+ - 2015-04-16: Version 0.8.0
102
+ - Improve formatting of /show page
103
+ - Big version bump cause it is quite stable
104
+
105
+ - 2015-02-27: Version 0.1.7
106
+ - Fix invalid request on ?test
107
+
108
+ - 2014-08-05: Version 0.1.3
109
+ - Automatically include ignore filter
110
+
111
+ - 2014-08-13: Version 0.1.6
112
+ - Simplify install process
113
+ - Fix crash on 404 in /logs dir
114
+
115
+ - 2014-08-10: Version 0.1.5
116
+ - Fix crash in Rails 3
117
+
118
+ - 2014-08-08: Version 0.1.4
119
+ - Fix crash in ignore filter
120
+
104
121
  - 2014-07-17: Version 0.1.1
105
122
  - Refactored report method into base_store.rb - will be easier to make a new log store
106
123
  - Add link in UI to clear all (non-protected) logs
107
124
  - Add example of submitting logs from Sidekiq jobs
108
125
  - Show Protect/Share links on all tabs
109
126
  - Render hashes provided via Logster.add_to_env
110
- - 2014-08-05: Version 0.1.3
111
- - Automatically include ignore filter
112
- - 2014-08-08: Version 0.1.4
113
- - Fix crash in ignore filter
114
- - 2014-08-10: Version 0.1.5
115
- - Fix crash in Rails 3
116
- - 2014-08-13: Version 0.1.6
117
- - Simplify install process
118
- - Fix crash on 404 in /logs dir
119
- - 2015-02-27: Version 0.1.7
120
- - Fix invalid request on ?test
121
- - 2015-04-16: Version 0.8.0
122
- - Improve formatting of /show page
123
- - Big version bump cause it is quite stable
124
- - 2015-05-01: Version 0.8.1
125
- - Don't crash out logging routine if redis is down or stderr is closed
126
- - 2015-06-10: Version 0.8.2
127
- - Add hostname and process_id to env on all messages
128
- - 2015-06-16: Version 0.8.3
129
- - Chained loggers now respect chain ignore
130
- - Add hostname and process_id to env on all messages
127
+
128
+ - 2014-07-04: Version 0.0.12
129
+ - Feature: Able to share logs, at /logs/show/(hexdigits)
130
+ - Add protecting logs, so they aren't deleted when old (for use with sharing)
131
+ - Restructured Redis data model
132
+
133
+ - 2014-05-24: Version 0.0.10
134
+ - Correct context for error reporting
135
+ - Clean up backtraces of reported exceptions
136
+
137
+ - 2014-05-13: Version 0.0.9
138
+ - Stray debugger message removed, add window.location logging to js
139
+
140
+ - 2014-05-13: Version 0.0.8
141
+ - Fix pacakging binstubs by mistake
142
+
143
+ - 2014-05-13: Version 0.0.7
144
+ - Add support for javascript exception logging
145
+
146
+ - 2014-05-12: Version 0.0.6
147
+ - Add referer to env
148
+
149
+ - 2014-05-12: Version 0.0.5
150
+ - Feature: We now log basic rack environment with the messages
151
+ - Add your own with Logster.add_to_env(env, key, value)
152
+
153
+ - 2014-05-07: Version 0.0.4
154
+ - Feature: Ability to ignore patterns with Logster.store.ignore = [/regex/]
155
+ - Feature: Store backtraces, allow people to view them in the GUI
156
+
157
+ - 2014-05-07: Started changelog :)
158
+ - Report params in env tab
@@ -50,6 +50,21 @@ App.Router.map(function() {
50
50
  this.route("show", { path: "/show/:id" });
51
51
  });
52
52
 
53
+ var entityMap = {
54
+ "&": "&",
55
+ "<": "&lt;",
56
+ ">": "&gt;",
57
+ '"': '&quot;',
58
+ "'": '&#39;',
59
+ "/": '&#x2F;'
60
+ };
61
+
62
+ function escapeHtml(string) {
63
+ return String(string).replace(/[&<>"'\/]/g, function (s) {
64
+ return entityMap[s];
65
+ });
66
+ }
67
+
53
68
  function buildArrayString(array) {
54
69
  var buffer = [];
55
70
  _.each(array, function(v) {
@@ -58,7 +73,7 @@ function buildArrayString(array) {
58
73
  } else if (Object.prototype.toString.call(v) === '[object Array]') {
59
74
  buffer.push(buildArrayString(v));
60
75
  } else {
61
- buffer.push(escape(v.toString()));
76
+ buffer.push(escapeHtml(v.toString()));
62
77
  }
63
78
  });
64
79
  return '[' + buffer.join(', ') + ']';
@@ -70,10 +85,11 @@ function buildHashString(hash, recurse) {
70
85
  var buffer = [],
71
86
  hashes = [];
72
87
  _.each(hash, function(v, k) {
88
+
73
89
  if (v === null) {
74
90
  buffer.push('null');
75
91
  } else if (Object.prototype.toString.call(v) === '[object Array]') {
76
- buffer.push("<tr><td>" + escape(k) + "</td><td>" + buildArrayString(v) + "</td></tr>");
92
+ buffer.push("<tr><td>" + escapeHtml(k) + "</td><td>" + buildArrayString(v) + "</td></tr>");
77
93
  } else if (typeof v === "object") {
78
94
  hashes.push(k);
79
95
  } else {
@@ -101,10 +101,14 @@ module Logster
101
101
  end
102
102
 
103
103
  # todo - memoize?
104
- def solved_key
105
- if (version=env["application_version"]) &&
104
+ def solved_keys
105
+ if (versions=env["application_version"]) &&
106
106
  (backtrace && backtrace.length > 0)
107
- Digest::SHA1.hexdigest "#{version} #{backtrace}"
107
+ versions = [versions] if String === versions
108
+
109
+ versions.map do |version|
110
+ Digest::SHA1.hexdigest "#{version} #{backtrace}"
111
+ end
108
112
  end
109
113
  end
110
114
 
@@ -14,8 +14,10 @@ module Logster
14
14
 
15
15
 
16
16
  def save(message)
17
- if solved=message.solved_key
18
- return true if @redis.hget(solved_key, solved)
17
+ if keys=message.solved_keys
18
+ keys.each do |solved|
19
+ return true if @redis.hget(solved_key, solved)
20
+ end
19
21
  end
20
22
 
21
23
  @redis.multi do
@@ -60,9 +62,11 @@ module Logster
60
62
  end
61
63
 
62
64
  def solve(message_key)
63
- if (message = get(message_key)) && (key = message.solved_key)
65
+ if (message = get(message_key)) && (keys = message.solved_keys)
64
66
  # add a time so we can expire it
65
- @redis.hset(solved_key, key, Time.now.to_f.to_i)
67
+ keys.each do |s_key|
68
+ @redis.hset(solved_key, s_key, Time.now.to_f.to_i)
69
+ end
66
70
  end
67
71
  clear_solved
68
72
  end
@@ -187,7 +191,7 @@ module Logster
187
191
 
188
192
  @redis.hmget(hash_key, message_keys).each do |json|
189
193
  message = Message.from_json(json)
190
- if ignores.include? message.solved_key
194
+ unless (ignores & message.solved_keys).empty?
191
195
  delete message
192
196
  end
193
197
  end
@@ -1,3 +1,3 @@
1
1
  module Logster
2
- VERSION = "0.8.4.8.pre"
2
+ VERSION = "0.9.9"
3
3
  end
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'redis'
4
+ gem 'logster', path: '../../'
@@ -0,0 +1,10 @@
1
+ require 'redis'
2
+ require 'logster'
3
+
4
+ Logster.config.allow_grouping = true
5
+ Logster.config.application_version = "ABC123"
6
+ Logster.store = Logster::RedisStore.new
7
+
8
+ 10.times do
9
+ Logster.store.report(Logger::WARN, "application", "test warning", backtrace: "method1\nmethod2", env: {something: ["hello world", "hello places"], another: {thing: "something else"}})
10
+ end
@@ -257,6 +257,24 @@ class TestRedisStore < Minitest::Test
257
257
  Logster.config.application_version = nil
258
258
  end
259
259
 
260
+ def test_solve_grouped
261
+ Logster.config.allow_grouping = true
262
+ @store.report(Logger::WARN, "application", "test error1", backtrace: "backtrace1", env: { "application_version" => "xyz"})
263
+ m = @store.report(Logger::WARN, "application", "test error1", backtrace: "backtrace1", env: { "application_version" => "efg"})
264
+
265
+ assert_equal(1, @store.latest.count)
266
+
267
+ @store.solve(m.key)
268
+
269
+ @store.report(Logger::WARN, "application", "test error1", backtrace: "backtrace1", env: { "application_version" => "xyz"})
270
+ @store.report(Logger::WARN, "application", "test error1", backtrace: "backtrace1", env: { "application_version" => "efg"})
271
+
272
+ assert_equal(0, @store.latest.count)
273
+
274
+ ensure
275
+ Logster.config.allow_grouping = false
276
+ end
277
+
260
278
  def test_clears_solved
261
279
  m = @store.report(Logger::WARN, "application", "test error2", backtrace: "backtrace1", env: {"application_version" => "abc"})
262
280
  @store.solve(m.key)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4.8.pre
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - UI for viewing logs in Rack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-17 00:00:00.000000000 Z
11
+ date: 2015-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -113,6 +113,11 @@ files:
113
113
  - assets/fonts/fontawesome-webfont.ttf
114
114
  - assets/fonts/fontawesome-webfont.woff
115
115
  - assets/fonts/fontawesome-webfont.woff2
116
+ - assets/images/logster-apple-touch.png
117
+ - assets/images/logster-favicon.png
118
+ - assets/images/logster-logo.png
119
+ - assets/images/logster-logo.psd
120
+ - assets/images/logster-screenshot.png
116
121
  - assets/javascript/app.js
117
122
  - assets/javascript/components/message-info.hbs
118
123
  - assets/javascript/components/message-row.hbs
@@ -148,6 +153,8 @@ files:
148
153
  - lib/logster/web.rb
149
154
  - logster.gemspec
150
155
  - test/examples/test_sidekiq_reporter_example.rb
156
+ - test/fake_data/Gemfile
157
+ - test/fake_data/generate.rb
151
158
  - test/logster/middleware/test_reporter.rb
152
159
  - test/logster/middleware/test_viewer.rb
153
160
  - test/logster/test_base_store.rb
@@ -172,9 +179,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
179
  version: '0'
173
180
  required_rubygems_version: !ruby/object:Gem::Requirement
174
181
  requirements:
175
- - - ">"
182
+ - - ">="
176
183
  - !ruby/object:Gem::Version
177
- version: 1.3.1
184
+ version: '0'
178
185
  requirements: []
179
186
  rubyforge_project:
180
187
  rubygems_version: 2.4.5
@@ -183,6 +190,8 @@ specification_version: 4
183
190
  summary: UI for viewing logs in Rack
184
191
  test_files:
185
192
  - test/examples/test_sidekiq_reporter_example.rb
193
+ - test/fake_data/Gemfile
194
+ - test/fake_data/generate.rb
186
195
  - test/logster/middleware/test_reporter.rb
187
196
  - test/logster/middleware/test_viewer.rb
188
197
  - test/logster/test_base_store.rb