log_toolbox 1.0.0 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ab0c74326566d3f63c41afe1b88201488141290e
4
- data.tar.gz: e0808c1c4b47e113380cf9e2625d074e6ed10012
2
+ SHA256:
3
+ metadata.gz: 24e688450de60928e21dffc4f149fad36b8fdcccbc99c66a7490f8a7c120f26e
4
+ data.tar.gz: 906faf4de7058fd15a773dfd1e329642a912e09c4c7b7a7cebdf7d69f395be87
5
5
  SHA512:
6
- metadata.gz: a27847e65bc3f4a509c83d9f53bfbbe9c7dc68009f9ac0b9b9cf415d5cadb2e6ea08fb2ef965c8ac11d5d56c7ed327cb1f486376485c1ddbf778d58e383b3119
7
- data.tar.gz: ea248ffec06a96789ace5d7918b4be20d3b103b210bb09ccc0659cd4fa7a0ecacc5d724b98986277da99c363ce5b95735ff3de9092b3f1ee44985638da3060de
6
+ metadata.gz: 3306c7347f81a106a9d591c56462b9cd63edde7247a6c66ae0137eebda42dcb0db491e37415e71cf917248c1a7f2a389eb423642d9bf820bd809f590ce0ecbbb
7
+ data.tar.gz: d4aeec51d7a437a6124b64d15ed502cea87ec9f52780abc9f9959cd884e2a52724040104a130668c1d170c10831bd95d6b3243841fb22365d17e8d9fc71afff8
data/.gitignore CHANGED
@@ -9,3 +9,6 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ spec/dummy/log/*
13
+ spec/dummy/db/*.sqlite3
14
+ spec/dummy/tmp/*
@@ -6,3 +6,27 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Released] - 2019-05-21
8
8
 
9
+ ## [1.3.3] - 2020-11-25
10
+ ### Added
11
+ - Parametrize logstash protocol
12
+ - Refactor request logs
13
+
14
+ ## [1.3.2] - 2020-02-19
15
+ ### Fixed
16
+ - Fixed log simple sending to logstash
17
+
18
+ ## [1.3.1] - 2019-07-30
19
+ ### Fixed
20
+ - Missed log format on posting to logstash
21
+
22
+ ## [1.3.0] - 2019-07-30
23
+ ### Added
24
+ - Add feature to send log to logstash at stanging and production environment
25
+
26
+ ## [1.2.0] - 2019-07-24
27
+ ### Added
28
+ - Add feature to change log level of your application at running time
29
+
30
+ ## [1.1.0] - 2019-05-30
31
+ ### Changed
32
+ - Changed header correlation_id to activityID as requested by architecture team
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in log_toolbox.gemspec
4
4
  gemspec
5
+ gem 'sqlite3'
@@ -1,15 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- log_toolbox (1.0.0)
5
- actionpack (>= 4.0.0)
6
- activesupport (>= 4.0.0)
4
+ log_toolbox (1.3.3)
7
5
  lograge (>= 0.11.1)
8
6
  logstash-event (>= 1.2.02)
7
+ logstash-logger (>= 0.26.1)
8
+ rails (>= 4.0)
9
+ rspec (>= 3.0.0)
10
+ rspec-rails
9
11
 
10
12
  GEM
11
13
  remote: https://rubygems.org/
12
14
  specs:
15
+ actioncable (5.2.3)
16
+ actionpack (= 5.2.3)
17
+ nio4r (~> 2.0)
18
+ websocket-driver (>= 0.6.1)
19
+ actionmailer (5.2.3)
20
+ actionpack (= 5.2.3)
21
+ actionview (= 5.2.3)
22
+ activejob (= 5.2.3)
23
+ mail (~> 2.5, >= 2.5.4)
24
+ rails-dom-testing (~> 2.0)
13
25
  actionpack (5.2.3)
14
26
  actionview (= 5.2.3)
15
27
  activesupport (= 5.2.3)
@@ -23,11 +35,25 @@ GEM
23
35
  erubi (~> 1.4)
24
36
  rails-dom-testing (~> 2.0)
25
37
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
38
+ activejob (5.2.3)
39
+ activesupport (= 5.2.3)
40
+ globalid (>= 0.3.6)
41
+ activemodel (5.2.3)
42
+ activesupport (= 5.2.3)
43
+ activerecord (5.2.3)
44
+ activemodel (= 5.2.3)
45
+ activesupport (= 5.2.3)
46
+ arel (>= 9.0)
47
+ activestorage (5.2.3)
48
+ actionpack (= 5.2.3)
49
+ activerecord (= 5.2.3)
50
+ marcel (~> 0.3.1)
26
51
  activesupport (5.2.3)
27
52
  concurrent-ruby (~> 1.0, >= 1.0.2)
28
53
  i18n (>= 0.7, < 2)
29
54
  minitest (~> 5.1)
30
55
  tzinfo (~> 1.1)
56
+ arel (9.0.0)
31
57
  ast (2.4.0)
32
58
  builder (3.2.3)
33
59
  byebug (11.0.1)
@@ -36,21 +62,32 @@ GEM
36
62
  crass (1.0.4)
37
63
  diff-lcs (1.3)
38
64
  erubi (1.8.0)
65
+ globalid (0.4.2)
66
+ activesupport (>= 4.2.0)
39
67
  i18n (1.6.0)
40
68
  concurrent-ruby (~> 1.0)
41
69
  jaro_winkler (1.5.2)
42
- lograge (0.11.1)
70
+ lograge (0.11.2)
43
71
  actionpack (>= 4)
44
72
  activesupport (>= 4)
45
73
  railties (>= 4)
46
74
  request_store (~> 1.0)
47
75
  logstash-event (1.2.02)
76
+ logstash-logger (0.26.1)
77
+ logstash-event (~> 1.2)
48
78
  loofah (2.2.3)
49
79
  crass (~> 1.0.2)
50
80
  nokogiri (>= 1.5.9)
81
+ mail (2.7.1)
82
+ mini_mime (>= 0.1.1)
83
+ marcel (0.3.3)
84
+ mimemagic (~> 0.3.2)
51
85
  method_source (0.9.2)
86
+ mimemagic (0.3.5)
87
+ mini_mime (1.0.2)
52
88
  mini_portile2 (2.4.0)
53
89
  minitest (5.11.3)
90
+ nio4r (2.5.4)
54
91
  nokogiri (1.10.3)
55
92
  mini_portile2 (~> 2.4.0)
56
93
  parallel (1.17.0)
@@ -65,6 +102,19 @@ GEM
65
102
  rack (2.0.7)
66
103
  rack-test (1.1.0)
67
104
  rack (>= 1.0, < 3)
105
+ rails (5.2.3)
106
+ actioncable (= 5.2.3)
107
+ actionmailer (= 5.2.3)
108
+ actionpack (= 5.2.3)
109
+ actionview (= 5.2.3)
110
+ activejob (= 5.2.3)
111
+ activemodel (= 5.2.3)
112
+ activerecord (= 5.2.3)
113
+ activestorage (= 5.2.3)
114
+ activesupport (= 5.2.3)
115
+ bundler (>= 1.3.0)
116
+ railties (= 5.2.3)
117
+ sprockets-rails (>= 2.0.0)
68
118
  rails-dom-testing (2.0.3)
69
119
  activesupport (>= 4.2.0)
70
120
  nokogiri (>= 1.6)
@@ -77,50 +127,70 @@ GEM
77
127
  rake (>= 0.8.7)
78
128
  thor (>= 0.19.0, < 2.0)
79
129
  rainbow (3.0.0)
80
- rake (10.5.0)
81
- request_store (1.4.1)
130
+ rake (12.3.2)
131
+ request_store (1.5.0)
82
132
  rack (>= 1.4)
83
133
  rspec (3.8.0)
84
134
  rspec-core (~> 3.8.0)
85
135
  rspec-expectations (~> 3.8.0)
86
136
  rspec-mocks (~> 3.8.0)
87
- rspec-core (3.8.0)
137
+ rspec-core (3.8.2)
88
138
  rspec-support (~> 3.8.0)
89
- rspec-expectations (3.8.3)
139
+ rspec-expectations (3.8.4)
90
140
  diff-lcs (>= 1.2.0, < 2.0)
91
141
  rspec-support (~> 3.8.0)
92
- rspec-mocks (3.8.0)
142
+ rspec-mocks (3.8.1)
93
143
  diff-lcs (>= 1.2.0, < 2.0)
94
144
  rspec-support (~> 3.8.0)
95
- rspec-support (3.8.0)
96
- rubocop (0.68.1)
145
+ rspec-rails (3.8.2)
146
+ actionpack (>= 3.0)
147
+ activesupport (>= 3.0)
148
+ railties (>= 3.0)
149
+ rspec-core (~> 3.8.0)
150
+ rspec-expectations (~> 3.8.0)
151
+ rspec-mocks (~> 3.8.0)
152
+ rspec-support (~> 3.8.0)
153
+ rspec-support (3.8.2)
154
+ rubocop (0.71.0)
97
155
  jaro_winkler (~> 1.5.1)
98
156
  parallel (~> 1.10)
99
- parser (>= 2.5, != 2.5.1.1)
157
+ parser (>= 2.6)
100
158
  rainbow (>= 2.2.2, < 4.0)
101
159
  ruby-progressbar (~> 1.7)
102
- unicode-display_width (>= 1.4.0, < 1.6)
103
- ruby-progressbar (1.10.0)
104
- shoulda-matchers (3.1.2)
160
+ unicode-display_width (>= 1.4.0, < 1.7)
161
+ ruby-progressbar (1.10.1)
162
+ shoulda-matchers (3.1.3)
105
163
  activesupport (>= 4.0.0)
164
+ sprockets (4.0.2)
165
+ concurrent-ruby (~> 1.0)
166
+ rack (> 1, < 3)
167
+ sprockets-rails (3.2.2)
168
+ actionpack (>= 4.0)
169
+ activesupport (>= 4.0)
170
+ sprockets (>= 3.0.0)
171
+ sqlite3 (1.4.1)
106
172
  thor (0.20.3)
107
173
  thread_safe (0.3.6)
108
174
  tzinfo (1.2.5)
109
175
  thread_safe (~> 0.1)
110
- unicode-display_width (1.5.0)
176
+ unicode-display_width (1.6.0)
177
+ websocket-driver (0.7.3)
178
+ websocket-extensions (>= 0.1.0)
179
+ websocket-extensions (0.1.5)
111
180
 
112
181
  PLATFORMS
113
182
  ruby
114
183
 
115
184
  DEPENDENCIES
116
- bundler (~> 2.0)
185
+ bundler
117
186
  log_toolbox!
118
187
  pry
119
188
  pry-byebug
120
- rake (~> 10.0)
121
- rspec (~> 3.0)
189
+ rake
190
+ rspec-rails
122
191
  rubocop
123
192
  shoulda-matchers (~> 3.1)
193
+ sqlite3
124
194
 
125
195
  BUNDLED WITH
126
196
  2.0.1
data/README.md CHANGED
@@ -4,10 +4,6 @@ Ruby gem for logging
4
4
  =======
5
5
  # LogToolbox
6
6
 
7
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/log_toolbox`. To experiment with that code, run `bin/console` for an interactive prompt.
8
-
9
- TODO: Delete this and the text above, and describe your gem
10
-
11
7
  ## Installation
12
8
 
13
9
  Add this line to your application's Gemfile:
@@ -26,7 +22,7 @@ $ gem install log_toolbox
26
22
 
27
23
  ## Usage
28
24
 
29
- Create a rails initializer 'config/initializers/lograge.rb' with content
25
+ Add this line at the end of your 'config/application.rb'
30
26
 
31
27
  ```ruby
32
28
  LogToolbox::LogrageConfig.configure
@@ -40,6 +36,14 @@ class ApplicationController < ActionController::API
40
36
  end
41
37
  ```
42
38
 
39
+ Add these keys at your '.env' file
40
+
41
+ ```ruby
42
+ # Logstash
43
+ LOGSTASH_URL=utils-hml.aws.guideinvestimentos.com.br
44
+ LOGSTASH_PORT=5001
45
+ ```
46
+
43
47
  Now your application log was converted to json pattern.
44
48
 
45
49
  ### Log at controller
@@ -64,8 +68,29 @@ end
64
68
  LogToolbox::LogSimple.log_info('system was here') # => {"event_at":"2019-05-21 17:41:59 -0300","level":"INFO","service_name":"logging","version":"1.0.1","message":"system was here"}
65
69
  ```
66
70
 
67
- Also you can log with same methods log_info, log_warn, log_error and log_critical
71
+ Also you can log with same methods log_debug, log_info, log_warn, log_error and log_critical
72
+
73
+ ### Log routes
74
+
75
+ ## Add routes config to manage your log level
76
+
77
+ At your 'routes.rb' add log routes
78
+
79
+ ```ruby
80
+ Rails.application.routes.draw do
81
+ log_routes
82
+ end
83
+ ```
84
+
85
+ You can change your application log doing a POST at /log/change_level
86
+
87
+ ```json
88
+ {
89
+ "level": "FATAL"
90
+ }
91
+ ```
68
92
 
93
+ You can test your application log doing a GET at /log/test
69
94
 
70
95
  ## Development
71
96
 
@@ -1,19 +1,21 @@
1
- image: ruby:2.4.1
1
+ image: ruby:2.6.3
2
2
 
3
3
  pipelines:
4
4
  default:
5
5
  - step:
6
6
  script:
7
7
  - git archive --remote=git@bitbucket.org:guideinvestimentos/rails_defaults.git HEAD .rubocop.yml | tar -x
8
+ - gem update bundler
8
9
  - bundle install
9
10
  - gem install rubocop
10
- - rspec -fdoc
11
+ - bundle exec rspec -fdoc
11
12
  - rubocop .
12
13
 
13
14
  branches:
14
15
  master:
15
16
  - step:
16
17
  script:
18
+ - mkdir -p ~/.gem
17
19
  - gem build log_toolbox.gemspec
18
20
  - curl -u $RUBYGEMS_USERNAME:$RUBYGEMS_PASSWORD https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
19
21
  - chmod 0600 ~/.gem/credentials
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ log_routes
3
+ end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'log_toolbox/version'
4
+ require 'log_toolbox/log_routes'
5
+ require 'log_toolbox/log_controller'
4
6
  require 'log_toolbox/lograge_config'
5
7
  require 'log_toolbox/log_util'
6
8
  require 'log_toolbox/log_helper'
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'log_toolbox/log_payload'
4
+ require 'action_controller'
5
+
6
+ module LogToolbox
7
+ class LogController < ActionController::Base
8
+ include LogToolbox::LogPayload
9
+
10
+ def change_level
11
+ log_info("Log level was changed to #{level_param}")
12
+ Rails.logger.level = Logger.const_get(level_param.upcase)
13
+
14
+ render json: {
15
+ message: "Your application log level was changed to #{rails_logger}",
16
+ log_options: options,
17
+ log_levels: levels
18
+ }
19
+ end
20
+
21
+ def test
22
+ log_debug('Log level DEBUG')
23
+ log_info('Log level INFO')
24
+ log_warn('Log level WARN')
25
+ log_error('Log level ERR')
26
+ log_critical('Log level CRIT')
27
+
28
+ render json: {
29
+ message: "Your application log level is #{rails_logger}",
30
+ log_options: options,
31
+ log_levels: levels
32
+ }
33
+ end
34
+
35
+ private
36
+
37
+ def options
38
+ %w[DEBUG INFO WARN ERROR FATAL]
39
+ end
40
+
41
+ def levels
42
+ { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, FATAL: 4 }
43
+ end
44
+
45
+ def rails_logger
46
+ Rails.logger.level
47
+ end
48
+
49
+ def level_param
50
+ params.require(:level)
51
+ end
52
+ end
53
+ end
@@ -7,7 +7,7 @@ module LogToolbox
7
7
  'fatal',
8
8
  additional.merge(
9
9
  message: error.try(:message),
10
- exception_stack: error.try(:backtrace),
10
+ backtrace: error.try(:backtrace),
11
11
  status: 500
12
12
  )
13
13
  )
@@ -25,13 +25,17 @@ module LogToolbox
25
25
  log_pattern('info', additional.merge(message: message))
26
26
  end
27
27
 
28
+ def log_debug(message, additional = {})
29
+ log_pattern('debug', additional.merge(message: message))
30
+ end
31
+
28
32
  private
29
33
 
30
- # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
34
+ # rubocop:disable Metrics/MethodLength
31
35
  def default_log(level)
32
36
  level = 'CRITICAL' if level == 'FATAL'
33
37
  {
34
- id: request.headers['correlation_id'],
38
+ activityID: request.headers['activityID'],
35
39
  event_at: I18n.l(Time.now, format: :timestamp),
36
40
  level: level,
37
41
  service_name: LogUtil.system_service_name,
@@ -41,7 +45,7 @@ module LogToolbox
41
45
  username: request.headers['Authorization']
42
46
  }
43
47
  end
44
- # rubocop:enable Metrics/AbcSize,Metrics/MethodLength
48
+ # rubocop:enable Metrics/MethodLength
45
49
 
46
50
  def log_pattern(level, log_hash)
47
51
  log = default_log(level.upcase).merge(log_hash)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support'
4
+ require 'log_toolbox/log_helper'
4
5
 
5
6
  module LogToolbox
6
7
  module LogPayload
@@ -10,8 +11,8 @@ module LogToolbox
10
11
  # rubocop:disable Metrics/AbcSize
11
12
  def append_info_to_payload(payload)
12
13
  super
13
- payload[:id] = request.headers['correlation_id']
14
- payload[:event_at] = I18n.l(Time.now, format: :timestamp)
14
+ payload[:activityID] = request.headers['activityID']
15
+ payload[:event_at] = I18n.l(Time.current, format: :timestamp)
15
16
  payload[:service_name] = LogUtil.system_service_name
16
17
  payload[:version] = LogUtil.system_version
17
18
  payload[:origin_ipv4] = request.env['REMOTE_ADDR']
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionDispatch
4
+ module Routing
5
+ class Mapper
6
+ def log_routes
7
+ match 'log/change_level(/:checks)(.:format)', to:
8
+ 'log_toolbox/log#change_level', via: :post
9
+
10
+ match 'log/test(/:checks)(.:format)', to:
11
+ 'log_toolbox/log#test', via: :get
12
+ end
13
+ end
14
+ end
15
+ end
@@ -15,11 +15,15 @@ module LogToolbox
15
15
  log_pattern('info', additional.merge(message: message))
16
16
  end
17
17
 
18
+ def log_debug(message, additional = {})
19
+ log_pattern('debug', additional.merge(message: message))
20
+ end
21
+
18
22
  private
19
23
 
20
24
  def log_pattern(level, log_hash)
21
25
  log = default_log(level.upcase).merge(log_hash)
22
- puts(normalize_hash(log))
26
+ Rails.logger.send(level, normalize_hash(log))
23
27
  end
24
28
 
25
29
  def default_log(level)
@@ -27,7 +31,7 @@ module LogToolbox
27
31
  event_at: I18n.l(Time.now, format: :timestamp),
28
32
  level: level,
29
33
  service_name: LogUtil.system_service_name,
30
- version: LogUtil.system_version,
34
+ version: LogUtil.system_version
31
35
  }
32
36
  end
33
37
 
@@ -1,30 +1,71 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'lograge'
4
+ require 'logstash-logger'
5
+
3
6
  module LogToolbox
4
7
  class LogrageConfig
5
- # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
8
+ attr_accessor :config
9
+
10
+ LOGSTASH_URL = ENV['LOGSTASH_URL']
11
+ LOGSTASH_PORT = ENV['LOGSTASH_PORT']
12
+ LOGSTASH_PROTOCOL = ENV.fetch('LOGSTASH_PROTOCOL', 'udp')
13
+
6
14
  def self.configure
7
15
  Rails.application.configure do
8
- config.lograge.enabled = true
9
- config.lograge.base_controller_class = 'ActionController::API'
10
- config.lograge.formatter = Lograge::Formatters::Json.new
11
-
12
- config.lograge.custom_options = lambda do |event|
13
- {
14
- id: event.payload[:id],
15
- event_at: event.payload[:event_at],
16
- level: 'INFO',
17
- service_name: event.payload[:service_name],
18
- version: event.payload[:version],
19
- origin_ipv4: event.payload[:origin_ipv4],
20
- destination_ipv4: event.payload[:destination_ipv4],
21
- username: event.payload[:username],
22
- exception_stack: event.payload[:exception_stack],
23
- response: event.payload[:response]
24
- }
16
+ log_config = LogToolbox::LogrageConfig.new(config)
17
+ log_config.configure_log_format
18
+ if ENV['RAILS_ENV'] == 'development'
19
+ log_config.configure_log_output_stdout
20
+ else
21
+ log_config.configure_log_output_logstash
25
22
  end
26
23
  end
27
- # rubocop:enable Metrics/AbcSize,Metrics/MethodLength
24
+ end
25
+
26
+ def initialize(config)
27
+ @config = config
28
+ end
29
+
30
+ def configure_log_output_logstash
31
+ config.logger = LogStashLogger.new(type: LOGSTASH_PROTOCOL,
32
+ host: LOGSTASH_URL,
33
+ port: LOGSTASH_PORT)
34
+ end
35
+
36
+ def configure_log_output_stdout
37
+ return unless ENV['RAILS_LOG_TO_STDOUT'].present?
38
+
39
+ logger = ActiveSupport::Logger.new($stdout)
40
+ logger.formatter = config.log_formatter
41
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
42
+ end
43
+
44
+ # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
45
+ def configure_log_format
46
+ config.lograge.enabled = true
47
+ config.lograge.base_controller_class = 'ActionController::API'
48
+ config.lograge.formatter = Lograge::Formatters::Json.new
49
+
50
+ config.lograge.custom_options = lambda do |event|
51
+ {
52
+ event_at: event.payload[:event_at],
53
+ parameters: event.payload[:params].to_json,
54
+ level: 'INFO',
55
+ service_name: event.payload[:service_name],
56
+ version: event.payload[:version],
57
+ origin_ipv4: event.payload[:origin_ipv4],
58
+ destination_ipv4: event.payload[:destination_ipv4],
59
+ username: wso2_user_name(event.payload[:headers][:HTTP_USER_IDENTIFIER])
60
+ }
61
+ end
62
+ end
63
+ # rubocop:enable Metrics/AbcSize,Metrics/MethodLength
64
+
65
+ def wso2_user_name(http_user_identifier)
66
+ return nil unless http_user_identifier.is_a? String
67
+
68
+ http_user_identifier ? JSON.parse(Base64.decode64(http_user_identifier))['user_name'] : nil
28
69
  end
29
70
  end
30
71
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LogToolbox
4
- VERSION = '1.0.0'
4
+ VERSION = '1.3.3'
5
5
  end
@@ -4,33 +4,38 @@ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'log_toolbox/version'
6
6
 
7
+ # rubocop:disable Metrics/BlockLength
7
8
  Gem::Specification.new do |spec|
8
- spec.name = 'log_toolbox'
9
- spec.version = LogToolbox::VERSION
10
- spec.authors = ['Caio Almeida']
11
- spec.email = ['cbalmeida@guide.com.br']
9
+ spec.name = 'log_toolbox'
10
+ spec.version = LogToolbox::VERSION
11
+ spec.authors = ['Caio Almeida']
12
+ spec.email = ['cbalmeida@guide.com.br']
12
13
 
13
- spec.summary = 'Guide default gem for ruby application logging'
14
- spec.homepage = 'http://bitbucket.org/guideinvestimentos/log_toolbox'
15
- spec.license = 'Guide'
14
+ spec.required_ruby_version = '>= 2.4.0'
15
+ spec.summary = 'Guide default gem for ruby application logging'
16
+ spec.homepage = 'http://bitbucket.org/guideinvestimentos/log_toolbox'
17
+ spec.license = 'Guide'
16
18
 
17
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
20
  `git ls-files -z`.split("\x0").reject do |f|
19
21
  f.match(%r{^(test|spec|features)/})
20
22
  end
21
23
  end
22
24
  spec.require_paths = ['lib']
23
25
 
24
- spec.add_dependency 'actionpack', '>= 4.0.0'
25
- spec.add_dependency 'activesupport', '>= 4.0.0'
26
26
  spec.add_dependency 'lograge', '>= 0.11.1'
27
27
  spec.add_dependency 'logstash-event', '>= 1.2.02'
28
+ spec.add_dependency 'logstash-logger', '>= 0.26.1'
29
+ spec.add_dependency 'rails', ['>= 4.0']
30
+ spec.add_dependency 'rspec', '>= 3.0.0'
31
+ spec.add_dependency 'rspec-rails'
28
32
 
29
- spec.add_development_dependency 'bundler', '~> 2.0'
33
+ spec.add_development_dependency 'bundler'
30
34
  spec.add_development_dependency 'pry'
31
35
  spec.add_development_dependency 'pry-byebug'
32
- spec.add_development_dependency 'rake', '~> 10.0'
33
- spec.add_development_dependency 'rspec', '~> 3.0'
36
+ spec.add_development_dependency 'rake'
37
+ spec.add_development_dependency 'rspec-rails'
34
38
  spec.add_development_dependency 'rubocop'
35
39
  spec.add_development_dependency 'shoulda-matchers', '~> 3.1'
36
40
  end
41
+ # rubocop:enable Metrics/BlockLength
metadata CHANGED
@@ -1,85 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caio Almeida
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-22 00:00:00.000000000 Z
11
+ date: 2020-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: actionpack
14
+ name: lograge
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: 0.11.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0
26
+ version: 0.11.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: activesupport
28
+ name: logstash-event
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0
33
+ version: 1.2.02
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.0
40
+ version: 1.2.02
41
41
  - !ruby/object:Gem::Dependency
42
- name: lograge
42
+ name: logstash-logger
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.11.1
47
+ version: 0.26.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.11.1
54
+ version: 0.26.1
55
55
  - !ruby/object:Gem::Dependency
56
- name: logstash-event
56
+ name: rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2.02
61
+ version: '4.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 1.2.02
68
+ version: '4.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 3.0.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 3.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: bundler
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - "~>"
101
+ - - ">="
74
102
  - !ruby/object:Gem::Version
75
- version: '2.0'
103
+ version: '0'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - "~>"
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
- version: '2.0'
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: pry
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -112,30 +140,30 @@ dependencies:
112
140
  name: rake
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
- - - "~>"
143
+ - - ">="
116
144
  - !ruby/object:Gem::Version
117
- version: '10.0'
145
+ version: '0'
118
146
  type: :development
119
147
  prerelease: false
120
148
  version_requirements: !ruby/object:Gem::Requirement
121
149
  requirements:
122
- - - "~>"
150
+ - - ">="
123
151
  - !ruby/object:Gem::Version
124
- version: '10.0'
152
+ version: '0'
125
153
  - !ruby/object:Gem::Dependency
126
- name: rspec
154
+ name: rspec-rails
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
- - - "~>"
157
+ - - ">="
130
158
  - !ruby/object:Gem::Version
131
- version: '3.0'
159
+ version: '0'
132
160
  type: :development
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
- - - "~>"
164
+ - - ">="
137
165
  - !ruby/object:Gem::Version
138
- version: '3.0'
166
+ version: '0'
139
167
  - !ruby/object:Gem::Dependency
140
168
  name: rubocop
141
169
  requirement: !ruby/object:Gem::Requirement
@@ -183,9 +211,12 @@ files:
183
211
  - bin/console
184
212
  - bin/setup
185
213
  - bitbucket-pipelines.yml
214
+ - config/routes.rb
186
215
  - lib/log_toolbox.rb
216
+ - lib/log_toolbox/log_controller.rb
187
217
  - lib/log_toolbox/log_helper.rb
188
218
  - lib/log_toolbox/log_payload.rb
219
+ - lib/log_toolbox/log_routes.rb
189
220
  - lib/log_toolbox/log_simple.rb
190
221
  - lib/log_toolbox/log_util.rb
191
222
  - lib/log_toolbox/lograge_config.rb
@@ -203,15 +234,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
203
234
  requirements:
204
235
  - - ">="
205
236
  - !ruby/object:Gem::Version
206
- version: '0'
237
+ version: 2.4.0
207
238
  required_rubygems_version: !ruby/object:Gem::Requirement
208
239
  requirements:
209
240
  - - ">="
210
241
  - !ruby/object:Gem::Version
211
242
  version: '0'
212
243
  requirements: []
213
- rubyforge_project:
214
- rubygems_version: 2.6.13
244
+ rubygems_version: 3.0.3
215
245
  signing_key:
216
246
  specification_version: 4
217
247
  summary: Guide default gem for ruby application logging