diff --git a/.rubocop.yml b/.rubocop.yml index 3a3b8bd..fc92aa5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 2.6 + TargetRubyVersion: 3.0.0 NewCops: enable Layout/LineLength: diff --git a/.ruby-version b/.ruby-version index 6a81b4c..fa7adc7 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.8 +3.3.5 diff --git a/CHANGELOG.md b/CHANGELOG.md index 20bf3f0..8396de4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog for the JSON Rails Logger gem +## 2.0.0 - 2024-12 + +- (Jon) Updated the gemspec for the required ruby version to 3.0.0 to ensure the + gem is up to date with the latest ruby version +- (Jon) Updated the gemspec to ensure the railties gem is locked to the 7.0 rails + version to avoid any potential issues with the gem being used +- (Jon) Updated the logging to include the `request_id` in the JSON output to + ensure the values are always logged to the system tooling. + ## 1.1.1 - 2024-10 - (Jon) Updated the exposed keys to allow more flexibility in the logging diff --git a/Gemfile b/Gemfile index e967149..c1dbc22 100644 --- a/Gemfile +++ b/Gemfile @@ -3,4 +3,10 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } +# Specify your gem's dependencies in json_rails_logger.gemspec gemspec + +group :development, :test do + gem 'rake', '~> 13.2', '>= 13.2.1' + gem 'rubocop', '~> 1.69', '>= 1.69.1' +end diff --git a/json_rails_logger.gemspec b/json_rails_logger.gemspec index ac910ed..83c256d 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' + spec.required_ruby_version = '>= 3.0.0' spec.metadata = { 'github_repo' => 'git@github.com:epimorphics/json-rails-logger.git', @@ -27,10 +27,7 @@ Gem::Specification.new do |spec| end spec.require_paths = ['lib'] - spec.add_runtime_dependency 'json', '~> 2.0' - spec.add_runtime_dependency 'lograge', '~> 0.11' - spec.add_runtime_dependency 'railties', '~> 6.0' - - spec.add_development_dependency 'rake', '~> 13.0' - spec.add_development_dependency 'rubocop', '~> 1.25.0' + spec.add_dependency 'json' + spec.add_dependency 'lograge' + spec.add_dependency 'railties', '~> 7.0' end diff --git a/lib/json_rails_logger/json_formatter.rb b/lib/json_rails_logger/json_formatter.rb index b988885..0d44d7b 100644 --- a/lib/json_rails_logger/json_formatter.rb +++ b/lib/json_rails_logger/json_formatter.rb @@ -62,12 +62,10 @@ def call(severity, timestamp, _progname, raw_msg) # rubocop:disable Metrics/AbcS level: sev } - payload.merge!(query_string.to_h) + payload.merge!(query_string.to_h) unless query_string.nil? payload.merge!(request_id.to_h) payload.merge!(new_msg.to_h.except!(:optional).compact) - "\n#{payload.to_json}\n" if Rails.env.development? - "#{payload.to_json}\n" end # rubocop:enable Metrics/MethodLength @@ -89,7 +87,7 @@ def request_id def query_string query_string = Thread.current[JsonRailsLogger::QUERY_STRING] - { query_string: query_string } if query_string + { query_string: query_string } if query_string.present? end def process_message(raw_msg) diff --git a/lib/json_rails_logger/version.rb b/lib/json_rails_logger/version.rb index 30f49fd..c989557 100644 --- a/lib/json_rails_logger/version.rb +++ b/lib/json_rails_logger/version.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true module JsonRailsLogger - MAJOR = 1 - MINOR = 1 - PATCH = 1 + MAJOR = 2 + MINOR = 0 + PATCH = 0 SUFFIX = nil - VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}#{SUFFIX && "-#{SUFFIX}"}" + VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}#{SUFFIX && "-#{SUFFIX}"}".freeze end