logster 2.19.0 → 2.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +3 -3
- data/CHANGELOG.md +9 -0
- data/assets/javascript/{chunk.143.007c0b8cac64ca844382.js → chunk.143.2f62415fa9ee8d84fb84.js} +4 -4
- data/assets/javascript/{chunk.178.c0a58aba01c86271384b.js → chunk.178.e362160626dc2d3791f7.js} +3 -3
- data/assets/javascript/client-app.js +331 -331
- data/client-app/app/components/message-info.js +1 -4
- data/client-app/yarn.lock +48 -42
- data/lib/logster/group.rb +0 -1
- data/lib/logster/logger.rb +60 -18
- data/lib/logster/message.rb +1 -1
- data/lib/logster/rails/railtie.rb +2 -2
- data/lib/logster/redis_rate_limiter.rb +1 -1
- data/lib/logster/redis_store.rb +5 -4
- data/lib/logster/version.rb +1 -1
- data/logster.gemspec +2 -2
- data/test/logster/middleware/test_viewer.rb +1 -1
- data/test/logster/test_logger.rb +40 -0
- data/test/logster/test_redis_store.rb +2 -0
- metadata +8 -8
@@ -94,10 +94,7 @@ export default class MessageInfo extends Component {
|
|
94
94
|
: "Message";
|
95
95
|
const message = `${header}\n\n${this.currentMessage.message}`;
|
96
96
|
|
97
|
-
const backtrace = `Backtrace\n\n${this.currentMessage.backtrace
|
98
|
-
.split("\n")
|
99
|
-
.slice(0, 10)
|
100
|
-
.join("\n")}`;
|
97
|
+
const backtrace = `Backtrace\n\n${this.currentMessage.backtrace}`;
|
101
98
|
|
102
99
|
const httpHosts = Array.isArray(this.currentMessage.env)
|
103
100
|
? this.currentMessage.env
|
data/client-app/yarn.lock
CHANGED
@@ -2426,13 +2426,13 @@ bluebird@^3.4.6, bluebird@^3.7.2:
|
|
2426
2426
|
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
|
2427
2427
|
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
|
2428
2428
|
|
2429
|
-
body-parser@1.20.
|
2430
|
-
version "1.20.
|
2431
|
-
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.
|
2432
|
-
integrity sha512-
|
2429
|
+
body-parser@1.20.2:
|
2430
|
+
version "1.20.2"
|
2431
|
+
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd"
|
2432
|
+
integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==
|
2433
2433
|
dependencies:
|
2434
2434
|
bytes "3.1.2"
|
2435
|
-
content-type "~1.0.
|
2435
|
+
content-type "~1.0.5"
|
2436
2436
|
debug "2.6.9"
|
2437
2437
|
depd "2.0.0"
|
2438
2438
|
destroy "1.2.0"
|
@@ -2440,7 +2440,7 @@ body-parser@1.20.1:
|
|
2440
2440
|
iconv-lite "0.4.24"
|
2441
2441
|
on-finished "2.4.1"
|
2442
2442
|
qs "6.11.0"
|
2443
|
-
raw-body "2.5.
|
2443
|
+
raw-body "2.5.2"
|
2444
2444
|
type-is "~1.6.18"
|
2445
2445
|
unpipe "1.0.0"
|
2446
2446
|
|
@@ -3419,7 +3419,7 @@ content-disposition@0.5.4:
|
|
3419
3419
|
dependencies:
|
3420
3420
|
safe-buffer "5.2.1"
|
3421
3421
|
|
3422
|
-
content-type@~1.0.4:
|
3422
|
+
content-type@~1.0.4, content-type@~1.0.5:
|
3423
3423
|
version "1.0.5"
|
3424
3424
|
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918"
|
3425
3425
|
integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==
|
@@ -3439,10 +3439,10 @@ cookie-signature@1.0.6:
|
|
3439
3439
|
resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c"
|
3440
3440
|
integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==
|
3441
3441
|
|
3442
|
-
cookie@0.
|
3443
|
-
version "0.
|
3444
|
-
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.
|
3445
|
-
integrity sha512-
|
3442
|
+
cookie@0.6.0:
|
3443
|
+
version "0.6.0"
|
3444
|
+
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051"
|
3445
|
+
integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==
|
3446
3446
|
|
3447
3447
|
cookie@~0.4.1:
|
3448
3448
|
version "0.4.2"
|
@@ -4356,15 +4356,15 @@ end-of-stream@^1.1.0:
|
|
4356
4356
|
dependencies:
|
4357
4357
|
once "^1.4.0"
|
4358
4358
|
|
4359
|
-
engine.io-parser@~5.
|
4360
|
-
version "5.
|
4361
|
-
resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.
|
4362
|
-
integrity sha512-
|
4359
|
+
engine.io-parser@~5.2.1:
|
4360
|
+
version "5.2.2"
|
4361
|
+
resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.2.2.tgz#37b48e2d23116919a3453738c5720455e64e1c49"
|
4362
|
+
integrity sha512-RcyUFKA93/CXH20l4SoVvzZfrSDMOTUS3bWVpTt2FuFP+XYrL8i8oonHP7WInRyVHXh0n/ORtoeiE1os+8qkSw==
|
4363
4363
|
|
4364
|
-
engine.io@~6.
|
4365
|
-
version "6.
|
4366
|
-
resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.
|
4367
|
-
integrity sha512-
|
4364
|
+
engine.io@~6.5.2:
|
4365
|
+
version "6.5.5"
|
4366
|
+
resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.5.5.tgz#430b80d8840caab91a50e9e23cb551455195fc93"
|
4367
|
+
integrity sha512-C5Pn8Wk+1vKBoHghJODM63yk8MvrO9EWZUfkAt5HAqIgPE4/8FF0PEGHXtEd40l223+cE5ABWuPzm38PHFXfMA==
|
4368
4368
|
dependencies:
|
4369
4369
|
"@types/cookie" "^0.4.1"
|
4370
4370
|
"@types/cors" "^2.8.12"
|
@@ -4374,8 +4374,8 @@ engine.io@~6.4.1:
|
|
4374
4374
|
cookie "~0.4.1"
|
4375
4375
|
cors "~2.8.5"
|
4376
4376
|
debug "~4.3.1"
|
4377
|
-
engine.io-parser "~5.
|
4378
|
-
ws "~8.
|
4377
|
+
engine.io-parser "~5.2.1"
|
4378
|
+
ws "~8.17.1"
|
4379
4379
|
|
4380
4380
|
enhanced-resolve@^5.10.0:
|
4381
4381
|
version "5.12.0"
|
@@ -4835,16 +4835,16 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2:
|
|
4835
4835
|
homedir-polyfill "^1.0.1"
|
4836
4836
|
|
4837
4837
|
express@^4.10.7, express@^4.17.1:
|
4838
|
-
version "4.
|
4839
|
-
resolved "https://registry.yarnpkg.com/express/-/express-4.
|
4840
|
-
integrity sha512-
|
4838
|
+
version "4.19.2"
|
4839
|
+
resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465"
|
4840
|
+
integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==
|
4841
4841
|
dependencies:
|
4842
4842
|
accepts "~1.3.8"
|
4843
4843
|
array-flatten "1.1.1"
|
4844
|
-
body-parser "1.20.
|
4844
|
+
body-parser "1.20.2"
|
4845
4845
|
content-disposition "0.5.4"
|
4846
4846
|
content-type "~1.0.4"
|
4847
|
-
cookie "0.
|
4847
|
+
cookie "0.6.0"
|
4848
4848
|
cookie-signature "1.0.6"
|
4849
4849
|
debug "2.6.9"
|
4850
4850
|
depd "2.0.0"
|
@@ -5201,9 +5201,9 @@ flatted@^3.1.0:
|
|
5201
5201
|
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
|
5202
5202
|
|
5203
5203
|
follow-redirects@^1.0.0:
|
5204
|
-
version "1.15.
|
5205
|
-
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.
|
5206
|
-
integrity sha512-
|
5204
|
+
version "1.15.6"
|
5205
|
+
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
|
5206
|
+
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==
|
5207
5207
|
|
5208
5208
|
for-each@^0.3.3:
|
5209
5209
|
version "0.3.3"
|
@@ -7918,10 +7918,10 @@ range-parser@~1.2.1:
|
|
7918
7918
|
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
|
7919
7919
|
integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==
|
7920
7920
|
|
7921
|
-
raw-body@2.5.
|
7922
|
-
version "2.5.
|
7923
|
-
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.
|
7924
|
-
integrity sha512-
|
7921
|
+
raw-body@2.5.2:
|
7922
|
+
version "2.5.2"
|
7923
|
+
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a"
|
7924
|
+
integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==
|
7925
7925
|
dependencies:
|
7926
7926
|
bytes "3.1.2"
|
7927
7927
|
http-errors "2.0.0"
|
@@ -8564,25 +8564,26 @@ socket.io-adapter@~2.5.2:
|
|
8564
8564
|
dependencies:
|
8565
8565
|
ws "~8.11.0"
|
8566
8566
|
|
8567
|
-
socket.io-parser@~4.2.
|
8568
|
-
version "4.2.
|
8569
|
-
resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.
|
8570
|
-
integrity sha512
|
8567
|
+
socket.io-parser@~4.2.4:
|
8568
|
+
version "4.2.4"
|
8569
|
+
resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.4.tgz#c806966cf7270601e47469ddeec30fbdfda44c83"
|
8570
|
+
integrity sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==
|
8571
8571
|
dependencies:
|
8572
8572
|
"@socket.io/component-emitter" "~3.1.0"
|
8573
8573
|
debug "~4.3.1"
|
8574
8574
|
|
8575
8575
|
socket.io@^4.1.2:
|
8576
|
-
version "4.
|
8577
|
-
resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.
|
8578
|
-
integrity sha512-
|
8576
|
+
version "4.7.5"
|
8577
|
+
resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.7.5.tgz#56eb2d976aef9d1445f373a62d781a41c7add8f8"
|
8578
|
+
integrity sha512-DmeAkF6cwM9jSfmp6Dr/5/mfMwb5Z5qRrSXLpo3Fq5SqyU8CMF15jIN4ZhfSwu35ksM1qmHZDQ/DK5XTccSTvA==
|
8579
8579
|
dependencies:
|
8580
8580
|
accepts "~1.3.4"
|
8581
8581
|
base64id "~2.0.0"
|
8582
|
+
cors "~2.8.5"
|
8582
8583
|
debug "~4.3.2"
|
8583
|
-
engine.io "~6.
|
8584
|
+
engine.io "~6.5.2"
|
8584
8585
|
socket.io-adapter "~2.5.2"
|
8585
|
-
socket.io-parser "~4.2.
|
8586
|
+
socket.io-parser "~4.2.4"
|
8586
8587
|
|
8587
8588
|
sort-object-keys@^1.1.3:
|
8588
8589
|
version "1.1.3"
|
@@ -9698,6 +9699,11 @@ ws@~8.11.0:
|
|
9698
9699
|
resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143"
|
9699
9700
|
integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==
|
9700
9701
|
|
9702
|
+
ws@~8.17.1:
|
9703
|
+
version "8.17.1"
|
9704
|
+
resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b"
|
9705
|
+
integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==
|
9706
|
+
|
9701
9707
|
xdg-basedir@^4.0.0:
|
9702
9708
|
version "4.0.0"
|
9703
9709
|
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-4.0.0.tgz#4bc8d9984403696225ef83a1573cbbcb4e79db13"
|
data/lib/logster/group.rb
CHANGED
data/lib/logster/logger.rb
CHANGED
@@ -13,6 +13,7 @@ module Logster
|
|
13
13
|
super(nil)
|
14
14
|
@store = store
|
15
15
|
@chained = []
|
16
|
+
@subscribers = []
|
16
17
|
@skip_store = false
|
17
18
|
@logster_override_level_key = "logster_override_level_#{object_id}"
|
18
19
|
end
|
@@ -29,6 +30,17 @@ module Logster
|
|
29
30
|
@chained << logger
|
30
31
|
end
|
31
32
|
|
33
|
+
##
|
34
|
+
# Subscribe to log events.
|
35
|
+
#
|
36
|
+
# Example:
|
37
|
+
# logger.subscribe do |severity, message, progname, opts, &block|
|
38
|
+
# YourCustomLogger.log(severity, message, progname, opts, &block)
|
39
|
+
# end
|
40
|
+
def subscribe(&block)
|
41
|
+
@subscribers << block
|
42
|
+
end
|
43
|
+
|
32
44
|
def add_to_chained(logger, severity, message, progname, opts = nil, &block)
|
33
45
|
if logger.respond_to? :skip_store
|
34
46
|
old = logger.skip_store
|
@@ -73,24 +85,8 @@ module Logster
|
|
73
85
|
opts[:backtrace] = backtrace
|
74
86
|
end
|
75
87
|
|
76
|
-
|
77
|
-
|
78
|
-
# micro optimise for logging
|
79
|
-
while i < @chained.length
|
80
|
-
# TODO double yielding blocks
|
81
|
-
begin
|
82
|
-
add_to_chained(@chained[i], severity, message, progname, opts, &block)
|
83
|
-
rescue => e
|
84
|
-
# don't blow up if STDERR is somehow closed
|
85
|
-
begin
|
86
|
-
STDERR.puts "Failed to report message to chained logger #{e}"
|
87
|
-
rescue StandardError
|
88
|
-
nil
|
89
|
-
end
|
90
|
-
end
|
91
|
-
i += 1
|
92
|
-
end
|
93
|
-
end
|
88
|
+
notify_subscribers(severity, message, progname, opts, &block)
|
89
|
+
add_to_chained_loggers(severity, message, progname, opts, &block)
|
94
90
|
|
95
91
|
return if @skip_store
|
96
92
|
|
@@ -121,6 +117,52 @@ module Logster
|
|
121
117
|
|
122
118
|
private
|
123
119
|
|
120
|
+
def add_to_chained_loggers(severity, message, progname, opts, &block)
|
121
|
+
chained_length = @chained.length
|
122
|
+
|
123
|
+
if chained_length > 0
|
124
|
+
i = 0
|
125
|
+
# micro optimise for logging since while loop is almost twice as fast
|
126
|
+
while i < chained_length
|
127
|
+
begin
|
128
|
+
add_to_chained(@chained[i], severity, message, progname, opts, &block)
|
129
|
+
rescue => e
|
130
|
+
# don't blow up if STDERR is somehow closed
|
131
|
+
begin
|
132
|
+
STDERR.puts "Failed to report message to chained logger: #{e.class} (#{e.message})\n#{e.backtrace.join("\n")}"
|
133
|
+
rescue StandardError
|
134
|
+
nil
|
135
|
+
end
|
136
|
+
end
|
137
|
+
i += 1
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def notify_subscribers(severity, message, progname, opts, &block)
|
143
|
+
subscribers_length = @subscribers.length
|
144
|
+
|
145
|
+
if subscribers_length > 0
|
146
|
+
i = 0
|
147
|
+
|
148
|
+
# micro optimise for logging since while loop is almost twice as fast
|
149
|
+
while i < subscribers_length
|
150
|
+
begin
|
151
|
+
@subscribers[i].call(severity, message, progname, opts, &block)
|
152
|
+
rescue => e
|
153
|
+
# don't blow up if STDERR is somehow closed
|
154
|
+
begin
|
155
|
+
STDERR.puts "Failed to report message to subscriber: #{e.class} (#{e.message})\n#{e.backtrace.join("\n")}"
|
156
|
+
rescue StandardError
|
157
|
+
nil
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
i += 1
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
124
166
|
def report_to_store(severity, progname, message, opts = {})
|
125
167
|
@store.report(severity, progname, message, opts)
|
126
168
|
end
|
data/lib/logster/message.rb
CHANGED
@@ -7,7 +7,7 @@ module Logster::Rails
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
def set_logger(config)
|
10
|
-
return
|
10
|
+
return if !Logster.config.environments.include?(Rails.env.to_sym)
|
11
11
|
|
12
12
|
require "logster/middleware/debug_exceptions"
|
13
13
|
require "logster/middleware/reporter"
|
@@ -35,7 +35,7 @@ module Logster::Rails
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def initialize!(app)
|
38
|
-
return
|
38
|
+
return if !Logster.config.environments.include?(Rails.env.to_sym)
|
39
39
|
return unless logster_enabled?
|
40
40
|
|
41
41
|
if Logster.config.enable_js_error_reporting
|
data/lib/logster/redis_store.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "json"
|
4
|
-
require
|
4
|
+
# Disable rubocop because the require is only redundant for Ruby 3.2+ but we still support Ruby 3.1
|
5
|
+
require "set" # rubocop:disable Lint/RedundantRequireStatement
|
5
6
|
require "logster/base_store"
|
6
7
|
require "logster/redis_rate_limiter"
|
7
8
|
|
@@ -409,12 +410,12 @@ module Logster
|
|
409
410
|
if @redis.llen(list_key) > max_backlog
|
410
411
|
removed_keys = []
|
411
412
|
while removed_key = @redis.lpop(list_key)
|
412
|
-
|
413
|
+
if @redis.sismember(protected_key, removed_key)
|
414
|
+
removed_keys << removed_key
|
415
|
+
else
|
413
416
|
rmsg = get(removed_key, load_env: false)
|
414
417
|
delete(rmsg)
|
415
418
|
break
|
416
|
-
else
|
417
|
-
removed_keys << removed_key
|
418
419
|
end
|
419
420
|
end
|
420
421
|
removed_keys.reverse.each { |key| @redis.lpush(list_key, key) }
|
data/lib/logster/version.rb
CHANGED
data/logster.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
lib = File.expand_path("../lib", __FILE__)
|
5
|
-
$LOAD_PATH.unshift(lib)
|
5
|
+
$LOAD_PATH.unshift(lib) if !$LOAD_PATH.include?(lib)
|
6
6
|
require "logster/version"
|
7
7
|
|
8
8
|
Gem::Specification.new do |spec|
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency "guard-minitest"
|
38
38
|
spec.add_development_dependency "timecop"
|
39
39
|
spec.add_development_dependency "byebug", "~> 11.1.0"
|
40
|
-
spec.add_development_dependency "rubocop-discourse"
|
40
|
+
spec.add_development_dependency "rubocop-discourse"
|
41
41
|
spec.add_development_dependency "syntax_tree"
|
42
42
|
spec.add_development_dependency "sqlite3"
|
43
43
|
end
|
@@ -317,7 +317,7 @@ class TestViewer < Minitest::Test
|
|
317
317
|
%w[/logsie/javascript/client-app.js /logsie/javascript/vendor.js].each do |path|
|
318
318
|
response = request.get(path)
|
319
319
|
assert_equal(200, response.status)
|
320
|
-
|
320
|
+
assert %w[text/javascript application/javascript].include?(response.headers["content-type"])
|
321
321
|
end
|
322
322
|
end
|
323
323
|
|
data/test/logster/test_logger.rb
CHANGED
@@ -71,6 +71,46 @@ class TestLogger < Minitest::Test
|
|
71
71
|
assert_equal "test", @store.calls.first[2]
|
72
72
|
end
|
73
73
|
|
74
|
+
def test_subscribing_to_logger_events
|
75
|
+
custom_logger_klass =
|
76
|
+
Class.new do
|
77
|
+
attr_reader :events
|
78
|
+
|
79
|
+
def initialize
|
80
|
+
@events = []
|
81
|
+
end
|
82
|
+
|
83
|
+
def log(severity, message, progname, opts, &block)
|
84
|
+
@events.push({ severity:, message:, progname:, opts:, block: })
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
custom_logger = custom_logger_klass.new
|
89
|
+
|
90
|
+
@logger.subscribe do |severity, message, progname, opts, &block|
|
91
|
+
custom_logger.log(severity, message, progname, opts, &block)
|
92
|
+
end
|
93
|
+
|
94
|
+
@logger.add(0, "test", "prog", backtrace: "backtrace", env: { a: "x" })
|
95
|
+
@logger.add(1, nil, nil, backtrace: "backtrace") { "yielded message" }
|
96
|
+
|
97
|
+
first_event = custom_logger.events[0]
|
98
|
+
|
99
|
+
assert_equal(0, first_event[:severity])
|
100
|
+
assert_equal("test", first_event[:message])
|
101
|
+
assert_equal("prog", first_event[:progname])
|
102
|
+
assert_equal({ backtrace: "backtrace", env: { a: "x" } }, first_event[:opts])
|
103
|
+
assert_nil first_event[:block]
|
104
|
+
|
105
|
+
second_event = custom_logger.events[1]
|
106
|
+
|
107
|
+
assert_equal(1, second_event[:severity])
|
108
|
+
assert_nil second_event[:message]
|
109
|
+
assert_nil second_event[:progname]
|
110
|
+
assert_equal({ backtrace: "backtrace", env: nil }, second_event[:opts])
|
111
|
+
assert_equal("yielded message", second_event[:block].call)
|
112
|
+
end
|
113
|
+
|
74
114
|
class NewLogger < Logster::Logger
|
75
115
|
end
|
76
116
|
|
@@ -749,7 +749,9 @@ class TestRedisStore < Minitest::Test
|
|
749
749
|
Rack::MockRequest.env_for("/test").merge(
|
750
750
|
"HTTP_HOST" => "www.site.com",
|
751
751
|
"HTTP_USER_AGENT" => "SOME WHERE",
|
752
|
+
"rack.input" => StringIO.new("test"),
|
752
753
|
)
|
754
|
+
|
753
755
|
orig = env.dup
|
754
756
|
orig["test"] = "tests"
|
755
757
|
orig["test1"] = "tests1"
|
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: 2.
|
4
|
+
version: 2.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: rubocop-discourse
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: syntax_tree
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,8 +186,8 @@ files:
|
|
186
186
|
- assets/images/icon_144x144.png
|
187
187
|
- assets/images/icon_64x64.png
|
188
188
|
- assets/javascript/.gitkeep
|
189
|
-
- assets/javascript/chunk.143.
|
190
|
-
- assets/javascript/chunk.178.
|
189
|
+
- assets/javascript/chunk.143.2f62415fa9ee8d84fb84.js
|
190
|
+
- assets/javascript/chunk.178.e362160626dc2d3791f7.js
|
191
191
|
- assets/javascript/chunk.468.95dd450003497c781cb3.js
|
192
192
|
- assets/javascript/chunk.916.85a3fc9d873df80f5ea5.js
|
193
193
|
- assets/javascript/client-app.js
|