chili_logger 0.0.1 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
metadata CHANGED
@@ -1,15 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chili_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - lucas sandeville
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-27 00:00:00.000000000 Z
11
+ date: 2020-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.9.0
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.9'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.9.0
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.9'
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: bunny
15
35
  requirement: !ruby/object:Gem::Requirement
@@ -55,19 +75,29 @@ files:
55
75
  - LICENSE.txt
56
76
  - README.md
57
77
  - Rakefile
78
+ - assets/images/chili-logger-flow.png
79
+ - assets/images/chiligum-logging-system.gif
80
+ - assets/images/rabbit-basic-functioning.png
81
+ - assets/images/rabbit-topic-explanation.webp
58
82
  - bin/console
59
83
  - bin/setup
84
+ - chili_logger-0.0.6.gem
85
+ - chili_logger-0.0.7.gem
60
86
  - chili_logger.gemspec
61
87
  - lib/brokers/rabbit_broker.rb
88
+ - lib/brokers/sqs_broker.rb
62
89
  - lib/chili_logger.rb
63
90
  - lib/chili_logger/version.rb
64
91
  - lib/current_log_accessor.rb
65
- - lib/errors/config_error.rb
66
- - lib/errors/rabbitmq_error.rb
67
- - lib/helpers/rails_backtrace_cleaner.rb
68
- - lib/logs_coverage/chili_logger_coverage.yml
69
- - lib/logs_coverage/coverage_writer.rb
70
- - lib/logs_coverage/levantamento_provisório.yaml
92
+ - lib/errors/error_messages/config_error.rb
93
+ - lib/errors/logging_error_handler/logging_error_handler.rb
94
+ - lib/helpers/logs_coverage/chili_logger_coverage.yml
95
+ - lib/helpers/logs_coverage/coverage_writer.rb
96
+ - lib/helpers/logs_coverage/levantamento_provisório.yaml
97
+ - lib/helpers/values/default.rb
98
+ - lib/helpers/values/type_uniformizer/desc.rb
99
+ - lib/helpers/values/type_uniformizer/main_content.rb
100
+ - lib/helpers/values/type_uniformizer/user.rb
71
101
  - lib/message_writer/aws_ops_metadata.rb
72
102
  - lib/message_writer/message_writer.rb
73
103
  homepage: https://gitlab.com/chiligumdev/chili_logger
@@ -1,9 +0,0 @@
1
- # class for wrapping all other gem's classes
2
- class ChiliLogger
3
- # class for wrapping RabbitMQ/Bunny errors
4
- class RabbitMQError < StandardError
5
- def initialize(msg = "The provided data couldn't be converted")
6
- super(msg)
7
- end
8
- end
9
- end
@@ -1,130 +0,0 @@
1
- # Backtraces often include many lines that are not relevant for the context
2
- # under review. This makes it hard to find the signal amongst the backtrace
3
- # noise, and adds debugging time. With a BacktraceCleaner, filters and
4
- # silencers are used to remove the noisy lines, so that only the most relevant
5
- # lines remain.
6
- #
7
- # Filters are used to modify lines of data, while silencers are used to remove
8
- # lines entirely. The typical filter use case is to remove lengthy path
9
- # information from the start of each line, and view file paths relevant to the
10
- # app directory instead of the file system root. The typical silencer use case
11
- # is to exclude the output of a noisy library from the backtrace, so that you
12
- # can focus on the rest.
13
- #
14
- # bc = ActiveSupport::BacktraceCleaner.new
15
- # bc.add_filter { |line| line.gsub(Rails.root.to_s, '') } # strip the Rails.root prefix
16
- # bc.add_silencer { |line| line =~ /puma|rubygems/ } # skip any lines from puma or rubygems
17
- # bc.clean(exception.backtrace) # perform the cleanup
18
- #
19
- # To reconfigure an existing BacktraceCleaner (like the default one in Rails)
20
- # and show as much data as possible, you can always call
21
- # <tt>BacktraceCleaner#remove_silencers!</tt>, which will restore the
22
- # backtrace to a pristine state. If you need to reconfigure an existing
23
- # BacktraceCleaner so that it does not filter or modify the paths of any lines
24
- # of the backtrace, you can call <tt>BacktraceCleaner#remove_filters!</tt>
25
- # These two methods will give you a completely untouched backtrace.
26
-
27
- # BacktraceCleaner from Rails, copied ipsis literis
28
- # github: https://github.com/rails/rails/blob/fbe2433be6e052a1acac63c7faf287c52ed3c5ba/activesupport/lib/active_support/backtrace_cleaner.rb#L41
29
- class RailsBacktraceCleaner
30
- def initialize
31
- @filters = []
32
- @silencers = []
33
- add_gem_filter
34
- add_gem_silencer
35
- add_stdlib_silencer
36
- end
37
-
38
- # Returns the backtrace after all filters and silencers have been run
39
- # against it. Filters run first, then silencers.
40
- def clean(backtrace, kind = :silent)
41
- filtered = filter_backtrace(backtrace)
42
-
43
- case kind
44
- when :silent
45
- silence(filtered)
46
- when :noise
47
- noise(filtered)
48
- else
49
- filtered
50
- end
51
- end
52
- alias filter clean
53
-
54
- # Adds a filter from the block provided. Each line in the backtrace will be
55
- # mapped against this filter.
56
- #
57
- # # Will turn "/my/rails/root/app/models/person.rb" into "/app/models/person.rb"
58
- # backtrace_cleaner.add_filter { |line| line.gsub(Rails.root, '') }
59
- def add_filter(&block)
60
- @filters << block
61
- end
62
-
63
- # Adds a silencer from the block provided. If the silencer returns +true+
64
- # for a given line, it will be excluded from the clean backtrace.
65
- #
66
- # # Will reject all lines that include the word "puma", like "/gems/puma/server.rb" or "/app/my_puma_server/rb"
67
- # backtrace_cleaner.add_silencer { |line| line =~ /puma/ }
68
- def add_silencer(&block)
69
- @silencers << block
70
- end
71
-
72
- # Removes all silencers, but leaves in the filters. Useful if your
73
- # context of debugging suddenly expands as you suspect a bug in one of
74
- # the libraries you use.
75
- def remove_silencers!
76
- @silencers = []
77
- end
78
-
79
- # Removes all filters, but leaves in the silencers. Useful if you suddenly
80
- # need to see entire filepaths in the backtrace that you had already
81
- # filtered out.
82
- def remove_filters!
83
- @filters = []
84
- end
85
-
86
- private
87
-
88
- FORMATTED_GEMS_PATTERN = %r{/\A[^\/]+ \([\w.]+\) /}.freeze
89
-
90
- def add_gem_filter
91
- gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) }
92
- return if gems_paths.empty?
93
-
94
- gems_regexp = %r{(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)}
95
- gems_result = '\3 (\4) \5'
96
- add_filter { |line| line.sub(gems_regexp, gems_result) }
97
- end
98
-
99
- def add_gem_silencer
100
- add_silencer { |line| FORMATTED_GEMS_PATTERN.match(line).nil? }
101
- end
102
-
103
- def add_stdlib_silencer
104
- add_silencer { |line| line.start_with?(RbConfig::CONFIG['rubylibdir']) }
105
- end
106
-
107
- def filter_backtrace(backtrace)
108
- @filters.each do |f|
109
- backtrace = backtrace.map { |line| f.call(line) }
110
- end
111
-
112
- backtrace
113
- end
114
-
115
- def silence(backtrace)
116
- @silencers.each do |s|
117
- backtrace = backtrace.reject { |line| s.call(line) }
118
- end
119
-
120
- backtrace
121
- end
122
-
123
- def noise(backtrace)
124
- backtrace.select do |line|
125
- @silencers.any? do |s|
126
- s.call(line)
127
- end
128
- end
129
- end
130
- end