diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 892015f..8ba329e 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -10,7 +10,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.6 + ruby-version: 2.6 - name: Install dependencies (bundle) run: bundle install - name: Run tests diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cb2f8b..b99d0fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog for the JSON Rails Logger gem +## 0.3.5.5 - 2023-05-10 + +- (Jon) Reverted the `gemspec` file to ensure the gem accepts higher ruby versions +and allows it to work with current app integrations; e.g. regulated products +- (Jon) Reverted the `unit_tests.yml` file to ensure the test accepts higher ruby +versions and allows it to work with current app integrations; e.g. regulated products + ## 0.3.5.4 - 2023-03-24 - (Jon) Removed the rails specific properties from the JSON output as they are not diff --git a/json_rails_logger.gemspec b/json_rails_logger.gemspec index 7853cdd..19993f0 100644 --- a/json_rails_logger.gemspec +++ b/json_rails_logger.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.email = 'info@epimorphics.com' spec.homepage = 'https://github.com/epimorphics/json-rails-logger' spec.license = 'MIT' - spec.required_ruby_version = '= 2.6.6' + spec.required_ruby_version = '>= 2.6' spec.metadata = { 'github_repo' => 'git@github.com:epimorphics/json-rails-logger.git', diff --git a/lib/json_rails_logger/json_formatter.rb b/lib/json_rails_logger/json_formatter.rb index 5b3d78a..7bf2df5 100644 --- a/lib/json_rails_logger/json_formatter.rb +++ b/lib/json_rails_logger/json_formatter.rb @@ -7,7 +7,7 @@ class JsonFormatter < ::Logger::Formatter method path status duration user_agent accept request_id ].freeze - def call(severity, timestamp, progname, raw_msg) + def call(severity, timestamp, _progname, raw_msg) sev = process_severity(severity) timestp = process_timestamp(timestamp) msg = process_message(raw_msg) @@ -46,7 +46,7 @@ def process_message(raw_msg) return get_message(msg) if get_message?(msg) return user_agent_message(msg) if user_agent_message?(msg) - { message: msg.strip } + { message: msg.squish } end # rubocop:disable Metrics/AbcSize @@ -55,6 +55,8 @@ def format_message(msg) return msg.merge(new_msg) if string_message_field?(msg) + return new_msg.merge(msg) if !msg.is_a?(Enumerable) + split_msg = msg.partition { |k, _v| COMMON_KEYS.include?(k.to_s) }.map(&:to_h) # If duration is a float, convert it to an integer as microseconds diff --git a/lib/json_rails_logger/version.rb b/lib/json_rails_logger/version.rb index fc75cdf..189d76b 100644 --- a/lib/json_rails_logger/version.rb +++ b/lib/json_rails_logger/version.rb @@ -4,7 +4,6 @@ module JsonRailsLogger MAJOR = 0 MINOR = 3 PATCH = 5 - SUFFIX = 4 + SUFFIX = 5 VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}#{SUFFIX && '.' + SUFFIX.to_s}" - end