logged 0.1.1 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 07c30d900b91114d024cb7aff82926e2fc335cf6
4
- data.tar.gz: 8f7a0312ec8bfb70d803b200b968dd8dd9c0a18a
2
+ SHA256:
3
+ metadata.gz: 0a24cad27e0dff599c750c8a6226209170c9f0ca67af809ac704b5a658561c5d
4
+ data.tar.gz: 42917190ea16b1b455f46143d4d79d1eacb6577da3f992f74ff4cdd333876880
5
5
  SHA512:
6
- metadata.gz: 83b88ebf6cc2fc16fbd43582d079b806e5e46a44c61e0a012892778f688f6d2e8de40475e72659fcdb4c7b06344b199c147920d5d53d937da84bf3a5e1cda551
7
- data.tar.gz: b96c022ed19d27f5a20f4daa2799f68338b4f4e9143db10dff43146a474972853a401453fb1cd5c69b8113db8b3eb87486f6e8a5d298e5df8f9652a236e5c47b
6
+ metadata.gz: 3e9c918618199e57f7b0a3aed15416a8ecfec5105ebffde1ebeb0df17fcd7415c280a966d1d90aa29a3ea170140bcb51777342b9ae105e8913ba2ba70ac19c80
7
+ data.tar.gz: 06500a9ea3c723a4e9b7c95e4c6b2e4ee8afe3ab827eb5f31651c16a1029e3f0ec80e5495ddcebc638f50f84691ff8590dc846eada3401427ffc760750cc2198
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,108 @@
1
+ stages:
2
+ - build
3
+ - test
4
+ - codequality
5
+ - security
6
+
7
+ build:
8
+ stage: build
9
+ image: ruby:2.6
10
+ script:
11
+ - gem install bundler --no-document
12
+ - bundle update
13
+ artifacts:
14
+ paths:
15
+ - Gemfile.lock
16
+
17
+ .rspec: &rspec
18
+ stage: test
19
+ before_script:
20
+ - ruby -v
21
+ - echo "${RSPEC_RAILS_VERSION}"
22
+ - gem install bundler -v "~>${BUNDLER_VERSION:-2.0}" --no-document
23
+ - export BUNDLE_GEMFILE="spec/Gemfile"
24
+ - bundle install --jobs=$(nproc) --path="../cache/bundle"
25
+ - bundle list
26
+ script:
27
+ - bundle exec rake spec
28
+ cache:
29
+ key: "$CI_JOB_NAME"
30
+ paths:
31
+ - cache/
32
+
33
+ rspec-ruby2.4-rails5.0:
34
+ <<: *rspec
35
+ image: ruby:2.4
36
+ variables:
37
+ RSPEC_RAILS_VERSION: "5.0"
38
+
39
+ rspec-ruby2.5-rails5.0:
40
+ <<: *rspec
41
+ image: ruby:2.5
42
+ variables:
43
+ RSPEC_RAILS_VERSION: "5.0"
44
+
45
+ rspec-ruby2.6-rails5.0:
46
+ <<: *rspec
47
+ image: ruby:2.6
48
+ variables:
49
+ RSPEC_RAILS_VERSION: "5.0"
50
+
51
+ rspec-ruby2.4-rails5.1:
52
+ <<: *rspec
53
+ image: ruby:2.4
54
+ variables:
55
+ RSPEC_RAILS_VERSION: "5.1"
56
+
57
+ rspec-ruby2.5-rails5.1:
58
+ <<: *rspec
59
+ image: ruby:2.5
60
+ variables:
61
+ RSPEC_RAILS_VERSION: "5.1"
62
+
63
+ rspec-ruby2.6-rails5.1:
64
+ <<: *rspec
65
+ image: ruby:2.6
66
+ variables:
67
+ RSPEC_RAILS_VERSION: "5.1"
68
+
69
+ rspec-ruby2.4-rails5.2:
70
+ <<: *rspec
71
+ image: ruby:2.4
72
+ variables:
73
+ RSPEC_RAILS_VERSION: "5.2"
74
+
75
+ rspec-ruby2.5-rails5.2:
76
+ <<: *rspec
77
+ image: ruby:2.5
78
+ variables:
79
+ RSPEC_RAILS_VERSION: "5.2"
80
+
81
+ rspec-ruby2.6-rails5.2:
82
+ <<: *rspec
83
+ image: ruby:2.6
84
+ variables:
85
+ RSPEC_RAILS_VERSION: "5.2"
86
+
87
+ rspec-ruby2.5-rails6.0:
88
+ <<: *rspec
89
+ image: ruby:2.5
90
+ variables:
91
+ RSPEC_RAILS_VERSION: "6.0"
92
+
93
+ rspec-ruby3.1-rails7.0:
94
+ <<: *rspec
95
+ image: ruby:3.1
96
+ variables:
97
+ RSPEC_RAILS_VERSION: "7.0"
98
+
99
+ rubocop:
100
+ stage: codequality
101
+ image: ruby:3.1
102
+ before_script:
103
+ - gem install rubocop rubocop-performance rubocop-rails --no-document
104
+ script:
105
+ - rubocop
106
+
107
+ include:
108
+ - template: Security/Dependency-Scanning.gitlab-ci.yml
data/.rubocop.yml CHANGED
@@ -1,10 +1,18 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rails
4
+
1
5
  AllCops:
6
+ TargetRubyVersion: 3.0
2
7
  Exclude:
3
- - 'spec/**/*'
4
- - '*.gemspec'
5
- - 'lib/logged/version.rb'
8
+ - "spec/**/*"
9
+ - "*.gemspec"
10
+
11
+ Layout/HashAlignment:
12
+ EnforcedHashRocketStyle: table
13
+ EnforcedColonStyle: table
6
14
 
7
- LineLength:
15
+ Layout/LineLength:
8
16
  Max: 120
9
17
 
10
18
  Metrics/MethodLength:
@@ -12,3 +20,396 @@ Metrics/MethodLength:
12
20
 
13
21
  Metrics/CyclomaticComplexity:
14
22
  Max: 8
23
+
24
+ Gemspec/DeprecatedAttributeAssignment:
25
+ Enabled: true
26
+
27
+ Gemspec/RequireMFA:
28
+ Enabled: true
29
+
30
+ Layout/LineContinuationLeadingSpace:
31
+ Enabled: true
32
+
33
+ Layout/LineContinuationSpacing:
34
+ Enabled: true
35
+
36
+ Layout/LineEndStringConcatenationIndentation:
37
+ Enabled: true
38
+
39
+ Layout/SpaceBeforeBrackets:
40
+ Enabled: true
41
+
42
+ Lint/AmbiguousAssignment:
43
+ Enabled: true
44
+
45
+ Lint/AmbiguousOperatorPrecedence:
46
+ Enabled: true
47
+
48
+ Lint/AmbiguousRange:
49
+ Enabled: true
50
+
51
+ Lint/ConstantOverwrittenInRescue:
52
+ Enabled: true
53
+
54
+ Lint/DeprecatedConstants:
55
+ Enabled: true
56
+
57
+ Lint/DuplicateBranch:
58
+ Enabled: true
59
+
60
+ Lint/DuplicateRegexpCharacterClassElement:
61
+ Enabled: true
62
+
63
+ Lint/EmptyBlock:
64
+ Enabled: true
65
+
66
+ Lint/EmptyClass:
67
+ Enabled: true
68
+
69
+ Lint/EmptyInPattern:
70
+ Enabled: true
71
+
72
+ Lint/IncompatibleIoSelectWithFiberScheduler:
73
+ Enabled: true
74
+
75
+ Lint/LambdaWithoutLiteralBlock:
76
+ Enabled: true
77
+
78
+ Lint/NoReturnInBeginEndBlocks:
79
+ Enabled: true
80
+
81
+ Lint/NonAtomicFileOperation:
82
+ Enabled: true
83
+
84
+ Lint/NumberedParameterAssignment:
85
+ Enabled: true
86
+
87
+ Lint/OrAssignmentToConstant:
88
+ Enabled: true
89
+
90
+ Lint/RedundantDirGlobSort:
91
+ Enabled: true
92
+
93
+ Lint/RefinementImportMethods:
94
+ Enabled: true
95
+
96
+ Lint/RequireRangeParentheses:
97
+ Enabled: true
98
+
99
+ Lint/RequireRelativeSelfPath:
100
+ Enabled: true
101
+
102
+ Lint/SymbolConversion:
103
+ Enabled: true
104
+
105
+ Lint/ToEnumArguments:
106
+ Enabled: true
107
+
108
+ Lint/TripleQuotes:
109
+ Enabled: true
110
+
111
+ Lint/UnexpectedBlockArity:
112
+ Enabled: true
113
+
114
+ Lint/UnmodifiedReduceAccumulator:
115
+ Enabled: true
116
+
117
+ Lint/UselessRuby2Keywords:
118
+ Enabled: true
119
+
120
+ Naming/BlockForwarding:
121
+ Enabled: true
122
+
123
+ Security/CompoundHash:
124
+ Enabled: true
125
+
126
+ Security/IoMethods:
127
+ Enabled: true
128
+
129
+ Style/ArgumentsForwarding:
130
+ Enabled: true
131
+
132
+ Style/CollectionCompact:
133
+ Enabled: true
134
+
135
+ Style/DocumentDynamicEvalDefinition:
136
+ Enabled: false
137
+
138
+ Style/EmptyHeredoc:
139
+ Enabled: true
140
+
141
+ Style/EndlessMethod:
142
+ Enabled: true
143
+
144
+ Style/EnvHome:
145
+ Enabled: true
146
+
147
+ Style/FetchEnvVar:
148
+ Enabled: true
149
+
150
+ Style/FileRead:
151
+ Enabled: true
152
+
153
+ Style/FileWrite:
154
+ Enabled: true
155
+
156
+ Style/HashConversion:
157
+ Enabled: true
158
+
159
+ Style/HashExcept:
160
+ Enabled: true
161
+
162
+ Style/IfWithBooleanLiteralBranches:
163
+ Enabled: true
164
+
165
+ Style/InPatternThen:
166
+ Enabled: true
167
+
168
+ Style/MagicCommentFormat:
169
+ Enabled: true
170
+
171
+ Style/MapCompactWithConditionalBlock:
172
+ Enabled: true
173
+
174
+ Style/MapToHash:
175
+ Enabled: true
176
+
177
+ Style/MultilineInPatternThen:
178
+ Enabled: true
179
+
180
+ Style/NegatedIfElseCondition:
181
+ Enabled: true
182
+
183
+ Style/NestedFileDirname:
184
+ Enabled: true
185
+
186
+ Style/NilLambda:
187
+ Enabled: true
188
+
189
+ Style/NumberedParameters:
190
+ Enabled: true
191
+
192
+ Style/NumberedParametersLimit:
193
+ Enabled: true
194
+
195
+ Style/ObjectThen:
196
+ Enabled: true
197
+
198
+ Style/OpenStructUse:
199
+ Enabled: true
200
+
201
+ Style/QuotedSymbols:
202
+ Enabled: true
203
+
204
+ Style/RedundantArgument:
205
+ Enabled: true
206
+
207
+ Style/RedundantInitialize:
208
+ Enabled: true
209
+
210
+ Style/RedundantSelfAssignmentBranch:
211
+ Enabled: true
212
+
213
+ Style/SelectByRegexp:
214
+ Enabled: true
215
+
216
+ Style/StringChars:
217
+ Enabled: true
218
+
219
+ Style/SwapValues:
220
+ Enabled: true
221
+
222
+ Performance/AncestorsInclude:
223
+ Enabled: true
224
+
225
+ Performance/BigDecimalWithNumericArgument:
226
+ Enabled: true
227
+
228
+ Performance/BlockGivenWithExplicitBlock:
229
+ Enabled: true
230
+
231
+ Performance/CollectionLiteralInLoop:
232
+ Enabled: true
233
+
234
+ Performance/ConcurrentMonotonicTime:
235
+ Enabled: true
236
+
237
+ Performance/ConstantRegexp:
238
+ Enabled: true
239
+
240
+ Performance/MapCompact:
241
+ Enabled: false
242
+
243
+ Performance/MethodObjectAsBlock:
244
+ Enabled: true
245
+
246
+ Performance/RedundantEqualityComparisonBlock:
247
+ Enabled: true
248
+
249
+ Performance/RedundantSortBlock:
250
+ Enabled: true
251
+
252
+ Performance/RedundantSplitRegexpArgument:
253
+ Enabled: true
254
+
255
+ Performance/RedundantStringChars:
256
+ Enabled: true
257
+
258
+ Performance/ReverseFirst:
259
+ Enabled: true
260
+
261
+ Performance/SortReverse:
262
+ Enabled: true
263
+
264
+ Performance/Squeeze:
265
+ Enabled: true
266
+
267
+ Performance/StringIdentifierArgument:
268
+ Enabled: true
269
+
270
+ Performance/StringInclude:
271
+ Enabled: true
272
+
273
+ Performance/Sum:
274
+ Enabled: true
275
+
276
+ Rails/ActionControllerFlashBeforeRender:
277
+ Enabled: true
278
+
279
+ Rails/ActionControllerTestCase:
280
+ Enabled: true
281
+
282
+ Rails/ActiveRecordCallbacksOrder:
283
+ Enabled: true
284
+
285
+ Rails/ActiveSupportOnLoad:
286
+ Enabled: true
287
+
288
+ Rails/AddColumnIndex:
289
+ Enabled: true
290
+
291
+ Rails/AfterCommitOverride:
292
+ Enabled: true
293
+
294
+ Rails/AttributeDefaultBlockValue:
295
+ Enabled: true
296
+
297
+ Rails/CompactBlank:
298
+ Enabled: false
299
+
300
+ Rails/DeprecatedActiveModelErrorsMethods:
301
+ Enabled: true
302
+
303
+ Rails/DotSeparatedKeys:
304
+ Enabled: true
305
+
306
+ Rails/DuplicateAssociation:
307
+ Enabled: true
308
+
309
+ Rails/DuplicateScope:
310
+ Enabled: true
311
+
312
+ Rails/DurationArithmetic:
313
+ Enabled: true
314
+
315
+ Rails/EagerEvaluationLogMessage:
316
+ Enabled: true
317
+
318
+ Rails/ExpandedDateRange:
319
+ Enabled: true
320
+
321
+ Rails/FindById:
322
+ Enabled: true
323
+
324
+ Rails/FreezeTime:
325
+ Enabled: true
326
+
327
+ Rails/I18nLazyLookup:
328
+ Enabled: true
329
+
330
+ Rails/I18nLocaleAssignment:
331
+ Enabled: true
332
+
333
+ Rails/I18nLocaleTexts:
334
+ Enabled: true
335
+
336
+ Rails/Inquiry:
337
+ Enabled: true
338
+
339
+ Rails/MailerName:
340
+ Enabled: true
341
+
342
+ Rails/MatchRoute:
343
+ Enabled: true
344
+
345
+ Rails/MigrationClassName:
346
+ Enabled: true
347
+
348
+ Rails/NegateInclude:
349
+ Enabled: true
350
+
351
+ Rails/Pluck:
352
+ Enabled: true
353
+
354
+ Rails/PluckInWhere:
355
+ Enabled: true
356
+
357
+ Rails/RedundantPresenceValidationOnBelongsTo:
358
+ Enabled: true
359
+
360
+ Rails/RedundantTravelBack:
361
+ Enabled: true
362
+
363
+ Rails/RenderInline:
364
+ Enabled: true
365
+
366
+ Rails/RenderPlainText:
367
+ Enabled: true
368
+
369
+ Rails/RootJoinChain:
370
+ Enabled: true
371
+
372
+ Rails/RootPathnameMethods:
373
+ Enabled: true
374
+
375
+ Rails/RootPublicPath:
376
+ Enabled: true
377
+
378
+ Rails/ShortI18n:
379
+ Enabled: true
380
+
381
+ Rails/SquishedSQLHeredocs:
382
+ Enabled: true
383
+
384
+ Rails/StripHeredoc:
385
+ Enabled: true
386
+
387
+ Rails/TimeZoneAssignment:
388
+ Enabled: true
389
+
390
+ Rails/ToFormattedS:
391
+ Enabled: true
392
+
393
+ Rails/ToSWithArgument:
394
+ Enabled: true
395
+
396
+ Rails/TopLevelHashWithIndifferentAccess:
397
+ Enabled: true
398
+
399
+ Rails/TransactionExitStatement:
400
+ Enabled: true
401
+
402
+ Rails/UnusedIgnoredColumns:
403
+ Enabled: true
404
+
405
+ Rails/WhereEquals:
406
+ Enabled: true
407
+
408
+ Rails/WhereExists:
409
+ Enabled: true
410
+
411
+ Rails/WhereMissing:
412
+ Enabled: true
413
+
414
+ Rails/WhereNot:
415
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,9 +1,46 @@
1
- # Change Log
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Support for Rails 7.0
13
+
14
+ ### Changed
15
+
16
+ - Droped support for Rails 4.x
17
+
18
+ ## [0.2.0] - 2019-08-22
19
+
20
+ ### Added
21
+
22
+ - Support for Rails 6.0
23
+
24
+ ### Changed
25
+
26
+ - Add magic comments for frozen string literals to all files
27
+ - Update rubocop settings
28
+ - Use rubocop-performance and rubocop-rails plugins
29
+
30
+ ## [0.1.2] - 2017-04-29
31
+
32
+ ### Changed
33
+
34
+ - Rails 5.1 compatibility
35
+
36
+ ## [0.1.1] - 2016-09-16
37
+
38
+ ### Changed
2
39
 
3
- ## 0.1.1 (2016-09-16)
4
- ### Changes
5
40
  - Rails 5.0 compatibility
6
41
 
7
- ## 0.1.0 (2015-08-13)
8
- ### Changes
42
+ ## [0.1.0] - 2015-08-13
43
+
44
+ ### Changed
45
+
9
46
  - Allow to disable/enable logger
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in logged.gemspec
data/README.md CHANGED
@@ -1,8 +1,3 @@
1
- [![Gem Version](https://img.shields.io/gem/v/logged.svg)](https://rubygems.org/gems/logged)
2
- [![Dependencies](https://img.shields.io/gemnasium/ydkn/logged.svg)](https://gemnasium.com/ydkn/logged)
3
- [![Travis CI](https://img.shields.io/travis/ydkn/logged.svg)](https://travis-ci.org/ydkn/logged)
4
- [![Code Climate](https://img.shields.io/codeclimate/github/ydkn/logged.svg)](https://codeclimate.com/github/ydkn/logged)
5
-
6
1
  # logged: configurable Rails logging
7
2
 
8
3
  Logged tries to make managing logging with Rails easier.
@@ -120,11 +115,3 @@ Rails.application.configure do
120
115
  config.logged.active_record.disable_rails_logging = true
121
116
  end
122
117
  ```
123
-
124
- ## Contributing
125
-
126
- 1. Fork it ( https://github.com/ydkn/logged/fork )
127
- 2. Create your feature branch (`git checkout -b my-new-feature`)
128
- 3. Commit your changes (`git commit -am 'Add some feature'`)
129
- 4. Push to the branch (`git push origin my-new-feature`)
130
- 5. Create a new Pull Request
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
 
3
5
  require 'rspec/core/rake_task'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/ordered_options'
2
4
 
3
5
  module Logged
@@ -12,23 +14,25 @@ module Logged
12
14
  tags: -> { [] },
13
15
  custom_ignore: nil,
14
16
  custom_data: nil
15
- }
17
+ }.freeze
16
18
 
17
19
  def self.init_default_options(config, ignore_defaults = [])
18
20
  DEFAULT_VALUES.each do |key, value|
19
21
  next if ignore_defaults.include?(key)
20
22
 
21
- if value.is_a?(Proc)
22
- config[key] = value.call
23
- else
24
- config[key] = value
25
- end
23
+ config[key] = if value.is_a?(Proc)
24
+ value.call
25
+ else
26
+ value
27
+ end
26
28
  end
27
29
  end
28
30
 
29
31
  # Configuration for loggers
30
32
  class LoggerOptions < ::ActiveSupport::OrderedOptions
31
33
  def initialize
34
+ super()
35
+
32
36
  Configuration.init_default_options(self, [:tags])
33
37
 
34
38
  self.enabled = true
@@ -38,6 +42,8 @@ module Logged
38
42
  # Configuration for components
39
43
  class ComponentOptions < ::ActiveSupport::OrderedOptions
40
44
  def initialize
45
+ super()
46
+
41
47
  Configuration.init_default_options(self)
42
48
 
43
49
  self.disable_rails_logging = false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Logged
2
4
  module Formatter
3
5
  # Definiation of a logged formatter
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'logged/formatter/base'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'logged/formatter/base'
2
4
 
3
5
  module Logged
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'logged/formatter/base'
2
4
  require 'logged/formatter/key_value'
3
5
 
@@ -6,6 +8,8 @@ module Logged
6
8
  # Logstash formatter for logged
7
9
  class Logstash < Base
8
10
  def initialize(message_formatter = nil)
11
+ super()
12
+
9
13
  @message_formatter = message_formatter || KeyValue.new
10
14
  end
11
15
 
@@ -23,7 +27,7 @@ module Logged
23
27
  def load_dependencies
24
28
  require 'logstash-event'
25
29
  rescue LoadError
26
- STDERR.puts 'You need to install the logstash-event gem to use the logstash formatter.'
30
+ warn('You need to install the logstash-event gem to use the logstash formatter.')
27
31
  raise
28
32
  end
29
33
  end