logster 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +18 -18
  3. data/.travis.yml +15 -15
  4. data/CHANGELOG.md +137 -130
  5. data/Gemfile +4 -4
  6. data/Guardfile +8 -8
  7. data/LICENSE.txt +22 -22
  8. data/README.md +99 -99
  9. data/Rakefile +24 -24
  10. data/assets/fonts/FontAwesome.otf +0 -0
  11. data/assets/fonts/fontawesome-webfont.eot +0 -0
  12. data/assets/fonts/fontawesome-webfont.svg +639 -639
  13. data/assets/fonts/fontawesome-webfont.ttf +0 -0
  14. data/assets/fonts/fontawesome-webfont.woff +0 -0
  15. data/assets/fonts/fontawesome-webfont.woff2 +0 -0
  16. data/assets/images/Icon-144_rounded.png +0 -0
  17. data/assets/images/Icon-144_square.png +0 -0
  18. data/assets/images/icon_144x144.png +0 -0
  19. data/assets/images/icon_64x64.png +0 -0
  20. data/assets/javascript/client-app.js +81 -81
  21. data/assets/javascript/vendor.js +5302 -5302
  22. data/assets/stylesheets/client-app.css +0 -0
  23. data/assets/stylesheets/vendor.css +3 -3
  24. data/build_client_app.sh +12 -12
  25. data/client-app/.editorconfig +20 -20
  26. data/client-app/.ember-cli +9 -9
  27. data/client-app/.eslintignore +19 -19
  28. data/client-app/.eslintrc.js +46 -46
  29. data/client-app/.gitignore +23 -23
  30. data/client-app/.travis.yml +27 -27
  31. data/client-app/.watchmanconfig +3 -3
  32. data/client-app/README.md +57 -57
  33. data/client-app/app/app.js +14 -14
  34. data/client-app/app/components/message-info.js +18 -18
  35. data/client-app/app/components/message-row.js +45 -45
  36. data/client-app/app/components/panel-resizer.js +75 -75
  37. data/client-app/app/components/tab-contents.js +27 -27
  38. data/client-app/app/components/tab-link.js +5 -5
  39. data/client-app/app/components/tabbed-section.js +32 -32
  40. data/client-app/app/components/time-formatter.js +25 -25
  41. data/client-app/app/components/update-time.js +21 -21
  42. data/client-app/app/controllers/index.js +83 -83
  43. data/client-app/app/controllers/show.js +13 -13
  44. data/client-app/app/index.html +29 -29
  45. data/client-app/app/initializers/app-init.js +55 -55
  46. data/client-app/app/lib/preload.js +14 -14
  47. data/client-app/app/lib/utilities.js +140 -140
  48. data/client-app/app/models/message-collection.js +158 -158
  49. data/client-app/app/models/message.js +99 -99
  50. data/client-app/app/resolver.js +3 -3
  51. data/client-app/app/router.js +14 -14
  52. data/client-app/app/routes/index.js +53 -53
  53. data/client-app/app/routes/show.js +14 -14
  54. data/client-app/app/styles/app.css +387 -387
  55. data/client-app/app/templates/application.hbs +2 -2
  56. data/client-app/app/templates/components/message-info.hbs +44 -44
  57. data/client-app/app/templates/components/message-row.hbs +17 -17
  58. data/client-app/app/templates/components/tabbed-section.hbs +10 -10
  59. data/client-app/app/templates/components/time-formatter.hbs +1 -1
  60. data/client-app/app/templates/index.hbs +57 -57
  61. data/client-app/app/templates/show.hbs +4 -4
  62. data/client-app/config/environment.js +51 -51
  63. data/client-app/config/optional-features.json +3 -3
  64. data/client-app/config/targets.js +18 -18
  65. data/client-app/ember-cli-build.js +29 -29
  66. data/client-app/package-lock.json +11365 -11365
  67. data/client-app/package.json +56 -56
  68. data/client-app/testem.js +25 -25
  69. data/client-app/tests/index.html +34 -34
  70. data/client-app/tests/integration/components/message-info-test.js +26 -26
  71. data/client-app/tests/integration/components/message-row-test.js +26 -26
  72. data/client-app/tests/integration/components/panel-resizer-test.js +26 -26
  73. data/client-app/tests/integration/components/tab-contents-test.js +26 -26
  74. data/client-app/tests/integration/components/tab-link-test.js +26 -26
  75. data/client-app/tests/integration/components/tabbed-section-test.js +26 -26
  76. data/client-app/tests/integration/components/time-formatter-test.js +26 -26
  77. data/client-app/tests/integration/components/update-time-test.js +26 -26
  78. data/client-app/tests/test-helper.js +8 -8
  79. data/client-app/tests/unit/controllers/index-test.js +12 -12
  80. data/client-app/tests/unit/controllers/show-test.js +12 -12
  81. data/client-app/tests/unit/initializers/app-init-test.js +31 -31
  82. data/client-app/tests/unit/routes/index-test.js +11 -11
  83. data/client-app/tests/unit/routes/show-test.js +11 -11
  84. data/lib/examples/sidekiq_logster_reporter.rb +21 -21
  85. data/lib/logster.rb +54 -54
  86. data/lib/logster/base_store.rb +130 -130
  87. data/lib/logster/configuration.rb +25 -25
  88. data/lib/logster/ignore_pattern.rb +65 -65
  89. data/lib/logster/logger.rb +108 -102
  90. data/lib/logster/message.rb +227 -227
  91. data/lib/logster/middleware/debug_exceptions.rb +26 -26
  92. data/lib/logster/middleware/reporter.rb +56 -56
  93. data/lib/logster/middleware/viewer.rb +220 -220
  94. data/lib/logster/rails/railtie.rb +58 -58
  95. data/lib/logster/redis_store.rb +481 -481
  96. data/lib/logster/version.rb +3 -3
  97. data/lib/logster/web.rb +14 -14
  98. data/logster.gemspec +34 -34
  99. data/test/examples/test_sidekiq_reporter_example.rb +46 -46
  100. data/test/fake_data/Gemfile +4 -4
  101. data/test/fake_data/generate.rb +10 -10
  102. data/test/logster/middleware/test_reporter.rb +21 -21
  103. data/test/logster/middleware/test_viewer.rb +96 -96
  104. data/test/logster/test_base_store.rb +147 -147
  105. data/test/logster/test_ignore_pattern.rb +41 -41
  106. data/test/logster/test_logger.rb +80 -74
  107. data/test/logster/test_message.rb +34 -34
  108. data/test/logster/test_redis_rate_limiter.rb +230 -230
  109. data/test/logster/test_redis_store.rb +427 -427
  110. data/test/test_helper.rb +38 -38
  111. data/vendor/assets/javascripts/logster.js.erb +39 -39
  112. metadata +3 -3
@@ -1,158 +1,158 @@
1
- import { ajax, increaseTitleCount } from "client-app/lib/utilities";
2
- import Message from "client-app/models/message";
3
- import { compare } from "@ember/utils";
4
- import { computed } from "@ember/object";
5
-
6
- export default Em.Object.extend({
7
- messages: Em.A(),
8
- currentMessage: null,
9
- total: 0,
10
-
11
- solve(message) {
12
- message.solve().then(() => {
13
- this.reload();
14
- });
15
- },
16
-
17
- destroy(message) {
18
- const messages = this.get("messages");
19
- const idx = messages.indexOf(message);
20
- message.destroy();
21
- message.set("selected", false);
22
- this.set("total", this.get("total") - 1);
23
- this.get("messages").removeObject(message);
24
-
25
- if (idx > 0) {
26
- message = messages[idx - 1];
27
- message.set("selected", true);
28
- this.set("currentMessage", message);
29
- } else {
30
- if (this.get("total") > 0) {
31
- message = messages[0];
32
- message.set("selected", true);
33
- this.set("currentMessage", message);
34
- } else {
35
- this.reload();
36
- }
37
- }
38
- },
39
-
40
- load(opts) {
41
- opts = opts || {};
42
-
43
- const data = {
44
- filter: this.get("filter").join("_")
45
- };
46
-
47
- const search = this.get("search");
48
- if (!_.isEmpty(search)) {
49
- data.search = search;
50
- const regexSearch = this.get("regexSearch");
51
- if (regexSearch) {
52
- data.regex_search = "true";
53
- }
54
- }
55
-
56
- if (opts.before) {
57
- data.before = opts.before;
58
- }
59
-
60
- if (opts.after) {
61
- data.after = opts.after;
62
- }
63
-
64
- ajax("/messages.json", {
65
- data: data
66
- }).then(data => {
67
- // guard against race: ensure the results we're trying to apply
68
- // match the current search terms
69
- if (compare(data.filter, this.get("filter")) != 0) {
70
- return;
71
- }
72
- if (compare(data.search, this.get("search")) != 0) {
73
- return;
74
- }
75
-
76
- if (data.messages.length > 0) {
77
- const newRows = this.toMessages(data.messages);
78
- const messages = this.get("messages");
79
- if (opts.before) {
80
- messages.unshiftObjects(newRows);
81
- } else {
82
- newRows.forEach(nmsg => {
83
- messages.forEach(emsg => {
84
- if (emsg.key == nmsg.key) {
85
- messages.removeObject(emsg);
86
- if (this.get("currentMessage") === emsg) {
87
- // TODO would updateFromJson() work here?
88
- this.set("currentMessage", nmsg);
89
- nmsg.set("selected", emsg.get("selected"));
90
- }
91
- }
92
- });
93
- });
94
- messages.addObjects(newRows);
95
- if (newRows.length > 0) {
96
- increaseTitleCount(newRows.length);
97
- }
98
- }
99
- }
100
- this.set("total", data.total);
101
- });
102
- },
103
-
104
- reload() {
105
- this.set("total", 0);
106
- this.get("messages").clear();
107
-
108
- this.load();
109
- },
110
-
111
- loadMore() {
112
- const messages = this.get("messages");
113
- if (messages.length === 0) {
114
- this.load({});
115
- return;
116
- }
117
-
118
- const lastKey = messages[messages.length - 1].get("key");
119
- this.load({
120
- after: lastKey
121
- });
122
- },
123
-
124
- moreBefore: computed("totalBefore", function() {
125
- return this.get("totalBefore") > 0;
126
- }),
127
-
128
- totalBefore: computed("total", "messages.length", function() {
129
- return this.get("total") - this.get("messages").length;
130
- }),
131
-
132
- showMoreBefore: function() {
133
- const messages = this.get("messages");
134
- const firstKey = messages[0].get("key");
135
-
136
- this.load({
137
- before: firstKey
138
- });
139
- },
140
-
141
- regexSearch: computed("search", function() {
142
- const search = this.get("search");
143
- if (search && search.length > 2 && search[0] === "/") {
144
- const match = search.match(/\/(.*)\/(.*)/);
145
- if (match && match.length === 3) {
146
- try {
147
- return new RegExp(match[1], match[2]);
148
- } catch (err) {
149
- // don't care
150
- }
151
- }
152
- }
153
- }),
154
-
155
- toMessages(messages) {
156
- return messages.map(m => Message.create(m));
157
- }
158
- });
1
+ import { ajax, increaseTitleCount } from "client-app/lib/utilities";
2
+ import Message from "client-app/models/message";
3
+ import { compare } from "@ember/utils";
4
+ import { computed } from "@ember/object";
5
+
6
+ export default Em.Object.extend({
7
+ messages: Em.A(),
8
+ currentMessage: null,
9
+ total: 0,
10
+
11
+ solve(message) {
12
+ message.solve().then(() => {
13
+ this.reload();
14
+ });
15
+ },
16
+
17
+ destroy(message) {
18
+ const messages = this.get("messages");
19
+ const idx = messages.indexOf(message);
20
+ message.destroy();
21
+ message.set("selected", false);
22
+ this.set("total", this.get("total") - 1);
23
+ this.get("messages").removeObject(message);
24
+
25
+ if (idx > 0) {
26
+ message = messages[idx - 1];
27
+ message.set("selected", true);
28
+ this.set("currentMessage", message);
29
+ } else {
30
+ if (this.get("total") > 0) {
31
+ message = messages[0];
32
+ message.set("selected", true);
33
+ this.set("currentMessage", message);
34
+ } else {
35
+ this.reload();
36
+ }
37
+ }
38
+ },
39
+
40
+ load(opts) {
41
+ opts = opts || {};
42
+
43
+ const data = {
44
+ filter: this.get("filter").join("_")
45
+ };
46
+
47
+ const search = this.get("search");
48
+ if (!_.isEmpty(search)) {
49
+ data.search = search;
50
+ const regexSearch = this.get("regexSearch");
51
+ if (regexSearch) {
52
+ data.regex_search = "true";
53
+ }
54
+ }
55
+
56
+ if (opts.before) {
57
+ data.before = opts.before;
58
+ }
59
+
60
+ if (opts.after) {
61
+ data.after = opts.after;
62
+ }
63
+
64
+ ajax("/messages.json", {
65
+ data: data
66
+ }).then(data => {
67
+ // guard against race: ensure the results we're trying to apply
68
+ // match the current search terms
69
+ if (compare(data.filter, this.get("filter")) != 0) {
70
+ return;
71
+ }
72
+ if (compare(data.search, this.get("search")) != 0) {
73
+ return;
74
+ }
75
+
76
+ if (data.messages.length > 0) {
77
+ const newRows = this.toMessages(data.messages);
78
+ const messages = this.get("messages");
79
+ if (opts.before) {
80
+ messages.unshiftObjects(newRows);
81
+ } else {
82
+ newRows.forEach(nmsg => {
83
+ messages.forEach(emsg => {
84
+ if (emsg.key == nmsg.key) {
85
+ messages.removeObject(emsg);
86
+ if (this.get("currentMessage") === emsg) {
87
+ // TODO would updateFromJson() work here?
88
+ this.set("currentMessage", nmsg);
89
+ nmsg.set("selected", emsg.get("selected"));
90
+ }
91
+ }
92
+ });
93
+ });
94
+ messages.addObjects(newRows);
95
+ if (newRows.length > 0) {
96
+ increaseTitleCount(newRows.length);
97
+ }
98
+ }
99
+ }
100
+ this.set("total", data.total);
101
+ });
102
+ },
103
+
104
+ reload() {
105
+ this.set("total", 0);
106
+ this.get("messages").clear();
107
+
108
+ this.load();
109
+ },
110
+
111
+ loadMore() {
112
+ const messages = this.get("messages");
113
+ if (messages.length === 0) {
114
+ this.load({});
115
+ return;
116
+ }
117
+
118
+ const lastKey = messages[messages.length - 1].get("key");
119
+ this.load({
120
+ after: lastKey
121
+ });
122
+ },
123
+
124
+ moreBefore: computed("totalBefore", function() {
125
+ return this.get("totalBefore") > 0;
126
+ }),
127
+
128
+ totalBefore: computed("total", "messages.length", function() {
129
+ return this.get("total") - this.get("messages").length;
130
+ }),
131
+
132
+ showMoreBefore: function() {
133
+ const messages = this.get("messages");
134
+ const firstKey = messages[0].get("key");
135
+
136
+ this.load({
137
+ before: firstKey
138
+ });
139
+ },
140
+
141
+ regexSearch: computed("search", function() {
142
+ const search = this.get("search");
143
+ if (search && search.length > 2 && search[0] === "/") {
144
+ const match = search.match(/\/(.*)\/(.*)/);
145
+ if (match && match.length === 3) {
146
+ try {
147
+ return new RegExp(match[1], match[2]);
148
+ } catch (err) {
149
+ // don't care
150
+ }
151
+ }
152
+ }
153
+ }),
154
+
155
+ toMessages(messages) {
156
+ return messages.map(m => Message.create(m));
157
+ }
158
+ });
@@ -1,99 +1,99 @@
1
- import { ajax, buildHashString } from "client-app/lib/utilities";
2
- import Preload from "client-app/lib/preload";
3
- import { computed } from "@ember/object";
4
-
5
- export default Em.Object.extend({
6
- MAX_LEN: 200,
7
-
8
- expand() {
9
- this.set("expanded", true);
10
- },
11
-
12
- solve() {
13
- return ajax("/solve/" + this.get("key"), { type: "PUT" });
14
- },
15
-
16
- destroy() {
17
- return ajax("/message/" + this.get("key"), { type: "DELETE" });
18
- },
19
-
20
- protect() {
21
- this.set("protected", true);
22
- return ajax("/protect/" + this.get("key"), { type: "PUT" });
23
- },
24
- unprotect() {
25
- this.set("protected", false);
26
- return ajax("/unprotect/" + this.get("key"), { type: "DELETE" });
27
- },
28
-
29
- showCount: computed("count", function() {
30
- return this.get("count") > 1;
31
- }),
32
-
33
- hasMore: computed("message", "expanded", function() {
34
- const message = this.get("message");
35
- const expanded = this.get("expanded");
36
-
37
- return !expanded && message.length > this.MAX_LEN;
38
- }),
39
-
40
- shareUrl: computed("key", function() {
41
- return Preload.get("rootPath") + "/show/" + this.get("key");
42
- }),
43
-
44
- displayMessage: computed("message", "expanded", function() {
45
- let message = this.get("message");
46
- const expanded = this.get("expanded");
47
-
48
- if (!expanded && message.length > this.MAX_LEN) {
49
- message = message.substr(0, this.MAX_LEN);
50
- }
51
- return message;
52
- }),
53
-
54
- updateFromObject(other) {
55
- // XXX Only updatable property is count right now
56
- this.set("count", other.get("count"));
57
- },
58
-
59
- canSolve: computed(function() {
60
- const backtrace = this.get("backtrace");
61
- return (
62
- this.get("env.application_version") && backtrace && backtrace.length > 0
63
- );
64
- }),
65
-
66
- envTable: computed("env", function() {
67
- return buildHashString(this.get("env"));
68
- }),
69
-
70
- rowClass: computed("severity", function() {
71
- switch (this.get("severity")) {
72
- case 0:
73
- return "debug";
74
- case 1:
75
- return "info";
76
- case 2:
77
- return "warn";
78
- case 3:
79
- return "error";
80
- case 4:
81
- return "fatal";
82
- }
83
- }),
84
-
85
- glyph: computed("severity", function() {
86
- switch (this.get("severity")) {
87
- case 0:
88
- return "";
89
- case 1:
90
- return "";
91
- case 2:
92
- return "<i class='fa fa-exclamation-circle warning'></i>";
93
- case 3:
94
- return "<i class='fa fa-times-circle error'></i>";
95
- case 4:
96
- return "<i class='fa fa-times-circle fatal'></i>";
97
- }
98
- })
99
- });
1
+ import { ajax, buildHashString } from "client-app/lib/utilities";
2
+ import Preload from "client-app/lib/preload";
3
+ import { computed } from "@ember/object";
4
+
5
+ export default Em.Object.extend({
6
+ MAX_LEN: 200,
7
+
8
+ expand() {
9
+ this.set("expanded", true);
10
+ },
11
+
12
+ solve() {
13
+ return ajax("/solve/" + this.get("key"), { type: "PUT" });
14
+ },
15
+
16
+ destroy() {
17
+ return ajax("/message/" + this.get("key"), { type: "DELETE" });
18
+ },
19
+
20
+ protect() {
21
+ this.set("protected", true);
22
+ return ajax("/protect/" + this.get("key"), { type: "PUT" });
23
+ },
24
+ unprotect() {
25
+ this.set("protected", false);
26
+ return ajax("/unprotect/" + this.get("key"), { type: "DELETE" });
27
+ },
28
+
29
+ showCount: computed("count", function() {
30
+ return this.get("count") > 1;
31
+ }),
32
+
33
+ hasMore: computed("message", "expanded", function() {
34
+ const message = this.get("message");
35
+ const expanded = this.get("expanded");
36
+
37
+ return !expanded && message.length > this.MAX_LEN;
38
+ }),
39
+
40
+ shareUrl: computed("key", function() {
41
+ return Preload.get("rootPath") + "/show/" + this.get("key");
42
+ }),
43
+
44
+ displayMessage: computed("message", "expanded", function() {
45
+ let message = this.get("message");
46
+ const expanded = this.get("expanded");
47
+
48
+ if (!expanded && message.length > this.MAX_LEN) {
49
+ message = message.substr(0, this.MAX_LEN);
50
+ }
51
+ return message;
52
+ }),
53
+
54
+ updateFromObject(other) {
55
+ // XXX Only updatable property is count right now
56
+ this.set("count", other.get("count"));
57
+ },
58
+
59
+ canSolve: computed(function() {
60
+ const backtrace = this.get("backtrace");
61
+ return (
62
+ this.get("env.application_version") && backtrace && backtrace.length > 0
63
+ );
64
+ }),
65
+
66
+ envTable: computed("env", function() {
67
+ return buildHashString(this.get("env"));
68
+ }),
69
+
70
+ rowClass: computed("severity", function() {
71
+ switch (this.get("severity")) {
72
+ case 0:
73
+ return "debug";
74
+ case 1:
75
+ return "info";
76
+ case 2:
77
+ return "warn";
78
+ case 3:
79
+ return "error";
80
+ case 4:
81
+ return "fatal";
82
+ }
83
+ }),
84
+
85
+ glyph: computed("severity", function() {
86
+ switch (this.get("severity")) {
87
+ case 0:
88
+ return "";
89
+ case 1:
90
+ return "";
91
+ case 2:
92
+ return "<i class='fa fa-exclamation-circle warning'></i>";
93
+ case 3:
94
+ return "<i class='fa fa-times-circle error'></i>";
95
+ case 4:
96
+ return "<i class='fa fa-times-circle fatal'></i>";
97
+ }
98
+ })
99
+ });