logster 2.9.8 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,6 +12,7 @@
12
12
  },
13
13
  "scripts": {
14
14
  "build": "ember build",
15
+ "lint": "npm run lint:js && npm run lint:hbs",
15
16
  "lint:hbs": "ember-template-lint .",
16
17
  "lint:js": "eslint .",
17
18
  "start": "ember serve",
@@ -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 = caller_locations
78
- while backtrace.first.path.end_with?("/logger.rb")
79
- backtrace.shift
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")}
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
+ require 'set'
4
5
  require 'logster/base_store'
5
6
  require 'logster/redis_rate_limiter'
6
7
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Logster
4
- VERSION = "2.9.8"
4
+ VERSION = "2.11.0"
5
5
  end
@@ -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.9.8
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: 2021-10-27 00:00:00.000000000 Z
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: