semantic_logger 4.7.4 → 4.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,29 +32,48 @@ module SemanticLogger
32
32
  end
33
33
  end
34
34
 
35
- SELF_PATTERN = File.join("lib", "semantic_logger")
36
-
37
- # Extract the backtrace leaving out the last few Semantic Logger lines.
35
+ # Extract the backtrace stripping off the leading semantic logger entries.
36
+ # Leaves all other system and gem path entries in place.
38
37
  def self.extract_backtrace(stack = caller)
39
- while (first = stack.first) && first.include?(SELF_PATTERN)
38
+ while (first = stack.first) && extract_path?(first)
40
39
  stack.shift
41
40
  end
42
41
  stack
43
42
  end
44
43
 
45
- # Strips off all gems and built-in ruby code paths from the top of the stack until application code is found.
44
+ def self.extract_paths
45
+ @extract_paths ||= %w[lib/semantic_logger lib/rails_semantic_logger]
46
+ end
47
+
48
+ # Whether this path should be excluded from any cleansed backtrace
49
+ def self.extract_path?(path)
50
+ extract_paths.any? { |exclude| path.include?(exclude) }
51
+ end
52
+
53
+ # Try to strip everything off of the supplied backtrace, until the first application stack entry is at the top.
54
+ # For example all leading gem paths and built-in ruby code paths are removed from the top.
55
+ # Once the first application entry is found, the remaining stack is returned.
46
56
  def self.strip_backtrace(stack = caller)
47
- while (first = stack.first) && system_path?(first)
57
+ while (first = stack.first) && (strip_path?(first) || extract_path?(first))
48
58
  stack.shift
49
59
  end
50
60
  stack
51
61
  end
52
62
 
53
- GEM_ROOT = File.expand_path("../../..", __dir__) + "/"
63
+ # Paths to exclude in the stripped backtrace
64
+ # Includes Gems and built-in Ruby code paths
65
+ def self.strip_paths
66
+ @strip_paths ||=
67
+ begin
68
+ paths = Gem.path | [Gem.default_dir]
69
+ paths << RbConfig::CONFIG["rubylibdir"]
70
+ paths
71
+ end
72
+ end
54
73
 
55
- def self.system_path?(path)
56
- path.start_with?(GEM_ROOT) ||
57
- path.start_with?(RbConfig::CONFIG["rubylibdir"])
74
+ # Whether this path should be excluded from any cleansed backtrace
75
+ def self.strip_path?(path)
76
+ strip_paths.any? { |exclude| path.start_with?(exclude) }
58
77
  end
59
78
  end
60
79
  end
@@ -1,3 +1,3 @@
1
1
  module SemanticLogger
2
- VERSION = "4.7.4".freeze
2
+ VERSION = "4.9.0".freeze
3
3
  end
@@ -32,6 +32,10 @@ module SemanticLogger
32
32
  autoload :Minitest, "semantic_logger/reporters/minitest"
33
33
  end
34
34
 
35
+ module Test
36
+ autoload :CaptureLogEvents, "semantic_logger/test/capture_log_events"
37
+ end
38
+
35
39
  if defined?(JRuby)
36
40
  module JRuby
37
41
  autoload :GarbageCollectionLogger, "semantic_logger/jruby/garbage_collection_logger"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.4
4
+ version: 4.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-21 00:00:00.000000000 Z
11
+ date: 2021-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -26,7 +26,6 @@ dependencies:
26
26
  version: '1.0'
27
27
  description:
28
28
  email:
29
- - reidmo@gmail.com
30
29
  executables: []
31
30
  extensions: []
32
31
  extra_rdoc_files: []
@@ -46,6 +45,7 @@ files:
46
45
  - lib/semantic_logger/appender/graylog.rb
47
46
  - lib/semantic_logger/appender/honeybadger.rb
48
47
  - lib/semantic_logger/appender/http.rb
48
+ - lib/semantic_logger/appender/io.rb
49
49
  - lib/semantic_logger/appender/kafka.rb
50
50
  - lib/semantic_logger/appender/mongodb.rb
51
51
  - lib/semantic_logger/appender/new_relic.rb
@@ -68,6 +68,7 @@ files:
68
68
  - lib/semantic_logger/formatters/default.rb
69
69
  - lib/semantic_logger/formatters/fluentd.rb
70
70
  - lib/semantic_logger/formatters/json.rb
71
+ - lib/semantic_logger/formatters/logfmt.rb
71
72
  - lib/semantic_logger/formatters/one_line.rb
72
73
  - lib/semantic_logger/formatters/raw.rb
73
74
  - lib/semantic_logger/formatters/signalfx.rb
@@ -87,9 +88,10 @@ files:
87
88
  - lib/semantic_logger/subscriber.rb
88
89
  - lib/semantic_logger/sync.rb
89
90
  - lib/semantic_logger/sync_processor.rb
91
+ - lib/semantic_logger/test/capture_log_events.rb
90
92
  - lib/semantic_logger/utils.rb
91
93
  - lib/semantic_logger/version.rb
92
- homepage: https://github.com/rocketjob/semantic_logger
94
+ homepage: https://logger.rocketjob.io
93
95
  licenses:
94
96
  - Apache-2.0
95
97
  metadata: {}
@@ -101,14 +103,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
103
  requirements:
102
104
  - - ">="
103
105
  - !ruby/object:Gem::Version
104
- version: '2.3'
106
+ version: '2.5'
105
107
  required_rubygems_version: !ruby/object:Gem::Requirement
106
108
  requirements:
107
109
  - - ">="
108
110
  - !ruby/object:Gem::Version
109
111
  version: '0'
110
112
  requirements: []
111
- rubygems_version: 3.1.4
113
+ rubygems_version: 3.0.9
112
114
  signing_key:
113
115
  specification_version: 4
114
116
  summary: Feature rich logging framework, and replacement for existing Ruby & Rails