manageiq-loggers 1.1.0 → 1.2.0

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
2
  SHA256:
3
- metadata.gz: b3074101daa2ad9391018a2bd3d9eb9c14588ec5872ffdf8fb6a3a88b119baaa
4
- data.tar.gz: 045bc78b9f4c4b97d2c3d7e2e45351025607100dff861397b42dba135a495334
3
+ metadata.gz: dd4bab057f20ec23828b6022014a09287dfa36cc6e949a4a08e9d9b2aaa44fcf
4
+ data.tar.gz: 678048c7efc29635002762d7d8e7f6cb0d5705dafbb4eac2d996dcf65fdb22e6
5
5
  SHA512:
6
- metadata.gz: 2b3675dd8cb799c3b830bb2683303b153e0d01b1a4ebd6b32e6d8b056d8df5bc76e9fd643fac317fcf0090f22ea7ea19935acd5ec90246e7e03b8e69597d063b
7
- data.tar.gz: defb9aa94eb27dfd54bb3dab055a7801daf3e282ca2a62f5706008788d3d54c6fc290ac382c2bcd54ac80667b05d6e44d2e1f5b4401523ff5e6e5b9af06e956b
6
+ metadata.gz: 2cc7c13f6f5b5b05f5acff45a9929fb5ae3029537b8270dbad33a40212b56de54e4484b3420c2ff03a9d8def9285698cd53aad592365e7fac2709a09c4f6beeb
7
+ data.tar.gz: adee41825340cc2d8138414f86e129f9d33b893d124a290508cea01ea3fce22bbd478fdfeb249ba281c172983733df26f59069bb795ce63ffc2a8831e46f9388
data/.codeclimate.yml CHANGED
@@ -31,4 +31,4 @@ plugins:
31
31
  rubocop:
32
32
  enabled: true
33
33
  config: ".rubocop_cc.yml"
34
- channel: rubocop-0-82
34
+ channel: rubocop-1-56-3
@@ -1,33 +1,39 @@
1
+ ---
1
2
  name: CI
2
-
3
3
  on:
4
4
  push:
5
5
  pull_request:
6
6
  schedule:
7
- - cron: '0 0 * * 0'
8
-
7
+ - cron: 0 0 * * 0
9
8
  jobs:
10
9
  ci:
11
10
  runs-on: ubuntu-latest
12
11
  strategy:
13
12
  matrix:
14
13
  ruby-version:
15
- - '2.6'
16
14
  - '2.7'
17
15
  - '3.0'
16
+ - '3.1'
17
+ - '3.2'
18
+ - '3.3'
19
+ rails-version:
20
+ - '6.1'
21
+ - '7.0'
22
+ - '7.1'
18
23
  env:
24
+ TEST_RAILS_VERSION: ${{ matrix.rails-version }}
19
25
  CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
20
26
  steps:
21
- - uses: actions/checkout@v2
27
+ - uses: actions/checkout@v4
22
28
  - name: Set up Ruby
23
29
  uses: ruby/setup-ruby@v1
24
30
  with:
25
- ruby-version: ${{ matrix.ruby-version }}
31
+ ruby-version: "${{ matrix.ruby-version }}"
26
32
  bundler-cache: true
27
33
  timeout-minutes: 30
28
34
  - name: Run tests
29
35
  run: bundle exec rake
30
36
  - name: Report code coverage
31
- if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '3.0' }}
37
+ if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '3.1' }}
32
38
  continue-on-error: true
33
- uses: paambaati/codeclimate-action@v3.0.0
39
+ uses: paambaati/codeclimate-action@v5
data/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.2.0] - 2024-09-30
9
+ ### Added
10
+ - Test with ruby 3.1 and 3.0 [(#65)](https://github.com/ManageIQ/manageiq-loggers/pull/65)
11
+ - Add ActiveSupport versions into the test matrix [(#77)](https://github.com/ManageIQ/manageiq-loggers/pull/77)
12
+ - Add a wrap method to support BroadcastLogger [(#63)](https://github.com/ManageIQ/manageiq-loggers/pull/63)
13
+
14
+ ## [1.1.1] - 2023-12-13
15
+ ### Fixed
16
+ - Fix Journald::Formatter's arguments list [(#61)](https://github.com/ManageIQ/manageiq-loggers/pull/61)
17
+ - Fix missing ActiveSupport::Logger.broadcast [(#62)](https://github.com/ManageIQ/manageiq-loggers/pull/62)
18
+
19
+ ### Changed
20
+ - Update actions/checkout version to v4 [(#60)](https://github.com/ManageIQ/manageiq-loggers/pull/60)
21
+ - Update GitHub Actions versions [(#59)](https://github.com/ManageIQ/manageiq-loggers/pull/59)
22
+
8
23
  ## [1.1.0] - 2022-11-14
9
24
  ### Changed
10
25
  - Split out JSON logger from Container logger [(#49)](https://github.com/ManageIQ/manageiq-loggers/pull/49)
@@ -83,7 +98,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
83
98
 
84
99
  ## [0.1.0] - 2019-01-08
85
100
 
86
- [Unreleased]: https://github.com/ManageIQ/manageiq-loggers/compare/v1.1.0...master
101
+ [Unreleased]: https://github.com/ManageIQ/manageiq-loggers/compare/v1.2.0...master
102
+ [1.2.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v1.1.1...v1.2.0
103
+ [1.1.1]: https://github.com/ManageIQ/manageiq-loggers/compare/v1.1.0...v1.1.1
87
104
  [1.1.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v1.0.1...v1.1.0
88
105
  [1.0.1]: https://github.com/ManageIQ/manageiq-loggers/compare/v1.0.0...v1.0.1
89
106
  [1.0.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.8.0...v1.0.0
data/Gemfile CHANGED
@@ -2,3 +2,15 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in manageiq-loggers.gemspec
4
4
  gemspec
5
+
6
+ minimum_version =
7
+ case ENV['TEST_RAILS_VERSION']
8
+ when "6.1"
9
+ "~>6.1.7"
10
+ when "7.0"
11
+ "~>7.0.8"
12
+ else
13
+ "~>7.1.4"
14
+ end
15
+
16
+ gem "activesupport", minimum_version
@@ -10,6 +10,19 @@ module ManageIQ
10
10
  class Base < Logger
11
11
  MAX_LOG_LINE_LENGTH = 8.kilobytes
12
12
 
13
+ class << self
14
+ def wrap(source, *loggers)
15
+ loggers.flatten!
16
+ if ActiveSupport.gem_version >= Gem::Version.new("7.1.0")
17
+ require 'active_support/broadcast_logger'
18
+ ActiveSupport::BroadcastLogger.new(*loggers.unshift(source))
19
+ else
20
+ loggers.each { |logger| source.extend(ActiveSupport::Logger.broadcast(logger)) }
21
+ source
22
+ end
23
+ end
24
+ end
25
+
13
26
  def initialize(*_, **_)
14
27
  super
15
28
  self.level = INFO
@@ -28,6 +41,10 @@ module ManageIQ
28
41
  @local_levels = {}
29
42
  end
30
43
 
44
+ def wrap(loggers)
45
+ self.class.wrap(self, loggers)
46
+ end
47
+
31
48
  # Silences the logger for the duration of the block.
32
49
  #
33
50
  # Taken from activesupport/logger_silence
@@ -1,5 +1,5 @@
1
1
  require 'active_support'
2
- require 'active_support/core_ext/string'
2
+ require 'active_support/core_ext/object'
3
3
  require 'active_support/logger'
4
4
 
5
5
  module ManageIQ
@@ -20,7 +20,8 @@ module ManageIQ
20
20
 
21
21
  creds = {:access_key_id => access_key_id, :secret_access_key => secret_access_key}
22
22
  cloud_watch_logdev = CloudWatchLogger::Client.new(creds, log_group, log_stream)
23
- super(cloud_watch_logdev).tap { |logger| logger.extend(ActiveSupport::Logger.broadcast(container_logger)) }
23
+ cloud_watch_logger = super(cloud_watch_logdev)
24
+ cloud_watch_logger.wrap(container_logger)
24
25
  end
25
26
 
26
27
  def initialize(logdev, *args)
@@ -39,8 +39,14 @@ module ManageIQ
39
39
  end
40
40
  end
41
41
 
42
- message = formatter.call(format_severity(severity), progname, message)
43
- caller_object = caller_locations(3, 1).first
42
+ message = formatter.call(format_severity(severity), nil, progname, message)
43
+
44
+ # The call stack is different depending on if we are using the newer
45
+ # ActiveSupport::BroadcastLogger or the older ActiveSupport::Logger.broadcast
46
+ # so we have to account for that difference when walking up the caller_locations
47
+ # to get the "real" logging location.
48
+ callstack_start = ActiveSupport.gem_version >= Gem::Version.new("7.1.0") ? 7 : 3
49
+ caller_object = caller_locations(callstack_start, 1).first
44
50
 
45
51
  Systemd::Journal.message(
46
52
  :message => message,
@@ -69,7 +75,7 @@ module ManageIQ
69
75
  end
70
76
 
71
77
  class Formatter < Base::Formatter
72
- def call(severity, progname, msg)
78
+ def call(severity, _time, progname, msg)
73
79
  msg = prefix_task_id(msg2str(msg)).truncate(Base::MAX_LOG_LINE_LENGTH)
74
80
  "%5s -- %s: %s\n" % [severity, progname, msg]
75
81
  end
@@ -1,5 +1,5 @@
1
1
  module ManageIQ
2
2
  module Loggers
3
- VERSION = "1.1.0".freeze
3
+ VERSION = "1.2.0".freeze
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_development_dependency "bundler"
28
28
  spec.add_development_dependency "cloudwatchlogger"
29
- spec.add_development_dependency "manageiq-style"
29
+ spec.add_development_dependency "manageiq-style", ">= 1.5.2"
30
30
  spec.add_development_dependency "rake", ">= 12.3.3"
31
31
  spec.add_development_dependency "rspec", "~> 3.0"
32
32
  spec.add_development_dependency "simplecov", ">= 0.21.2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manageiq-loggers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Authors
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-14 00:00:00.000000000 Z
11
+ date: 2024-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 1.5.2
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 1.5.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.21.2
125
+ - !ruby/object:Gem::Dependency
126
+ name: systemd-journal
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description:
126
140
  email:
127
141
  executables: []
@@ -171,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
185
  - !ruby/object:Gem::Version
172
186
  version: '0'
173
187
  requirements: []
174
- rubygems_version: 3.3.18
188
+ rubygems_version: 3.4.20
175
189
  signing_key:
176
190
  specification_version: 4
177
191
  summary: Loggers for ManageIQ projects