logster 2.9.8 → 2.11.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 +15 -25
- data/CHANGELOG.md +17 -0
- data/README.md +6 -5
- data/Rakefile +1 -1
- data/assets/javascript/client-app.js +2 -2
- data/assets/stylesheets/client-app.css +1 -1
- data/client-app/app/index.html +2 -1
- data/client-app/app/styles/app.css +87 -1
- data/client-app/app/templates/show.hbs +2 -1
- data/client-app/package-lock.json +398 -468
- data/client-app/package.json +1 -0
- data/lib/logster/logger.rb +7 -3
- data/lib/logster/middleware/viewer.rb +1 -0
- data/lib/logster/redis_store.rb +1 -0
- data/lib/logster/version.rb +1 -1
- data/test/logster/test_logger.rb +22 -0
- metadata +5 -5
data/client-app/package.json
CHANGED
data/lib/logster/logger.rb
CHANGED
@@ -74,9 +74,13 @@ module Logster
|
|
74
74
|
# own methods don't show up as the first few frames in the backtrace
|
75
75
|
if !opts || !opts.key?(:backtrace)
|
76
76
|
opts ||= {}
|
77
|
-
backtrace =
|
78
|
-
|
79
|
-
|
77
|
+
backtrace = message.backtrace if message.kind_of?(::Exception)
|
78
|
+
backtrace ||= progname.backtrace if progname.kind_of?(::Exception)
|
79
|
+
if !backtrace
|
80
|
+
backtrace = caller_locations
|
81
|
+
while backtrace.first.path.end_with?("/logger.rb")
|
82
|
+
backtrace.shift
|
83
|
+
end
|
80
84
|
end
|
81
85
|
backtrace = backtrace.join("\n")
|
82
86
|
opts[:backtrace] = backtrace
|
@@ -372,6 +372,7 @@ module Logster
|
|
372
372
|
<link href='//fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
|
373
373
|
<link href='//fonts.googleapis.com/css?family=Roboto+Mono' rel='stylesheet' type='text/css'>
|
374
374
|
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes">
|
375
|
+
<meta name="color-scheme" content="dark light">
|
375
376
|
#{css("vendor.css")}
|
376
377
|
#{css("client-app.css")}
|
377
378
|
#{script("vendor.js")}
|
data/lib/logster/redis_store.rb
CHANGED
data/lib/logster/version.rb
CHANGED
data/test/logster/test_logger.rb
CHANGED
@@ -106,4 +106,26 @@ class TestLogger < Minitest::Test
|
|
106
106
|
@logger.skip_store = true
|
107
107
|
@logger.warn("testing")
|
108
108
|
end
|
109
|
+
|
110
|
+
def test_logging_an_error_gets_backtrace_from_the_error
|
111
|
+
exception = error_instance(Exception)
|
112
|
+
std_err = error_instance(StandardError)
|
113
|
+
custom_err = error_instance(Class.new(StandardError))
|
114
|
+
|
115
|
+
@logger.error(exception)
|
116
|
+
@logger.fatal(std_err)
|
117
|
+
@logger.fatal(custom_err)
|
118
|
+
|
119
|
+
assert_equal exception.backtrace.join("\n"), @store.calls[0][3][:backtrace]
|
120
|
+
assert_equal std_err.backtrace.join("\n"), @store.calls[1][3][:backtrace]
|
121
|
+
assert_equal custom_err.backtrace.join("\n"), @store.calls[2][3][:backtrace]
|
122
|
+
end
|
123
|
+
|
124
|
+
private
|
125
|
+
|
126
|
+
def error_instance(error_class)
|
127
|
+
raise error_class.new
|
128
|
+
rescue error_class => e
|
129
|
+
e
|
130
|
+
end
|
109
131
|
end
|
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.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -280,7 +280,7 @@ homepage: https://github.com/discourse/logster
|
|
280
280
|
licenses:
|
281
281
|
- MIT
|
282
282
|
metadata: {}
|
283
|
-
post_install_message:
|
283
|
+
post_install_message:
|
284
284
|
rdoc_options: []
|
285
285
|
require_paths:
|
286
286
|
- lib
|
@@ -296,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
296
|
version: '0'
|
297
297
|
requirements: []
|
298
298
|
rubygems_version: 3.1.6
|
299
|
-
signing_key:
|
299
|
+
signing_key:
|
300
300
|
specification_version: 4
|
301
301
|
summary: UI for viewing logs in Rack
|
302
302
|
test_files:
|