lib/logster/base_store.rb in logster-2.12.2 vs lib/logster/base_store.rb in logster-2.13.0
- old
+ new
@@ -1,10 +1,9 @@
# frozen_string_literal: true
module Logster
class BaseStore
-
attr_accessor :level, :max_retention, :skip_empty, :ignore, :allow_custom_patterns
def initialize
@max_retention = 60 * 60 * 24 * 7
@skip_empty = true
@@ -164,44 +163,48 @@
end
message.populate_from_env(env)
if backtrace
- if backtrace.respond_to? :join
- backtrace = backtrace.join("\n")
- end
+ backtrace = backtrace.join("\n") if backtrace.respond_to? :join
message.backtrace = backtrace
else
message.backtrace = caller.join("\n")
end
- return if ignore && ignore.any? do |pattern|
- if message =~ pattern
- val = Regexp === pattern ? pattern.inspect : pattern.to_s
- increment_ignore_count(val)
- true
- end
+ if ignore &&
+ ignore.any? { |pattern|
+ if message =~ pattern
+ val = Regexp === pattern ? pattern.inspect : pattern.to_s
+ increment_ignore_count(val)
+ true
+ end
+ }
+ return
end
if Logster.config.enable_custom_patterns_via_ui || allow_custom_patterns
- custom_ignore = @patterns_cache.fetch(Logster::SuppressionPattern::CACHE_KEY) do
- Logster::SuppressionPattern.find_all(store: self)
- end
- return if custom_ignore.any? do |pattern|
- if message =~ pattern
- increment_ignore_count(pattern.inspect)
- true
+ custom_ignore =
+ @patterns_cache.fetch(Logster::SuppressionPattern::CACHE_KEY) do
+ Logster::SuppressionPattern.find_all(store: self)
end
+ if custom_ignore.any? { |pattern|
+ if message =~ pattern
+ increment_ignore_count(pattern.inspect)
+ true
+ end
+ }
+ return
end
end
similar = nil
if Logster.config.allow_grouping
message.apply_message_size_limit(
Logster.config.maximum_message_size_bytes,
- gems_dir: Logster.config.gems_dir
+ gems_dir: Logster.config.gems_dir,
)
key = self.similar_key(message)
similar = get(key, load_env: false) if key
end
@@ -213,21 +216,22 @@
replace_and_bump(similar)
similar
else
message.apply_message_size_limit(
Logster.config.maximum_message_size_bytes,
- gems_dir: Logster.config.gems_dir
+ gems_dir: Logster.config.gems_dir,
)
saved = save(message)
message
end
message = similar || message
if (Logster.config.enable_custom_patterns_via_ui || allow_custom_patterns) && saved
- grouping_patterns = @patterns_cache.fetch(Logster::GroupingPattern::CACHE_KEY) do
- Logster::GroupingPattern.find_all(store: self)
- end
+ grouping_patterns =
+ @patterns_cache.fetch(Logster::GroupingPattern::CACHE_KEY) do
+ Logster::GroupingPattern.find_all(store: self)
+ end
grouping_patterns.each do |pattern|
if message =~ pattern
group = find_pattern_groups() { |pat| pat == pattern }[0]
group ||= Logster::Group.new(pattern.inspect)