manageiq-loggers 1.1.1 → 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: 2a32bea06f89fab47efe8276e4a6bb8847a4bb319d5f720a0fefa8b8e4af84df
4
- data.tar.gz: 9bb69c8569b7cd7c1f412ef61ee2b5b1c720ed8749b11bff4cb7d374c8db75ed
3
+ metadata.gz: dd4bab057f20ec23828b6022014a09287dfa36cc6e949a4a08e9d9b2aaa44fcf
4
+ data.tar.gz: 678048c7efc29635002762d7d8e7f6cb0d5705dafbb4eac2d996dcf65fdb22e6
5
5
  SHA512:
6
- metadata.gz: 3bcc952f60b915db50ca50fb798d78ee80554849a6f36026550d235a4365f2ebba1908ec82a5035a529bdda56299a98196811e7bb29e815919a814f758bc39ad
7
- data.tar.gz: aa68849ecdc51297a67e256e35b6cc894e0ed5d1a9a369997e28a2f5791ac8f4411aac8cf72a2fee3cd596ddcb38a1eda6a959b34e2b5c78a5cfb4a130221632
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
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
39
  uses: paambaati/codeclimate-action@v5
data/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ 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
+
8
14
  ## [1.1.1] - 2023-12-13
9
15
  ### Fixed
10
16
  - Fix Journald::Formatter's arguments list [(#61)](https://github.com/ManageIQ/manageiq-loggers/pull/61)
@@ -92,7 +98,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
92
98
 
93
99
  ## [0.1.0] - 2019-01-08
94
100
 
95
- [Unreleased]: https://github.com/ManageIQ/manageiq-loggers/compare/v1.1.1...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
96
103
  [1.1.1]: https://github.com/ManageIQ/manageiq-loggers/compare/v1.1.0...v1.1.1
97
104
  [1.1.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v1.0.1...v1.1.0
98
105
  [1.0.1]: https://github.com/ManageIQ/manageiq-loggers/compare/v1.0.0...v1.0.1
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)
@@ -40,7 +40,13 @@ module ManageIQ
40
40
  end
41
41
 
42
42
  message = formatter.call(format_severity(severity), nil, progname, message)
43
- caller_object = caller_locations(3, 1).first
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,
@@ -1,5 +1,5 @@
1
1
  module ManageIQ
2
2
  module Loggers
3
- VERSION = "1.1.1".freeze
3
+ VERSION = "1.2.0".freeze
4
4
  end
5
5
  end
@@ -21,12 +21,12 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_runtime_dependency "activesupport", ">= 5.0", "< 7.1"
24
+ spec.add_runtime_dependency "activesupport", ">= 5.0"
25
25
  spec.add_runtime_dependency "manageiq-password", "< 2"
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.1
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: 2023-12-13 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
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.0'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '7.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '5.0'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '7.1'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: manageiq-password
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +72,14 @@ dependencies:
78
72
  requirements:
79
73
  - - ">="
80
74
  - !ruby/object:Gem::Version
81
- version: '0'
75
+ version: 1.5.2
82
76
  type: :development
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
80
  - - ">="
87
81
  - !ruby/object:Gem::Version
88
- version: '0'
82
+ version: 1.5.2
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: rake
91
85
  requirement: !ruby/object:Gem::Requirement