Skip to content

Commit

Permalink
Merge pull request #51 from epimorphics/spike/updated-param-naming
Browse files Browse the repository at this point in the history
Updated Parameter Naming
  • Loading branch information
jonrandahl authored Jun 21, 2023
2 parents ed5c31c + d439eb8 commit 3d77909
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog for the JSON Rails Logger gem

## 1.0.2 - 2023-06-21

- (Jon) Renamed parameter to reduce chance of conflict with other gems or code
that may use the same parameter name.

## 1.0.1 - 2023-06-07

- (Jon) Updated the logging to include additional properties to ensure the
Expand Down
4 changes: 3 additions & 1 deletion lib/json_rails_logger/json_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module JsonRailsLogger
class JsonFormatter < ::Logger::Formatter
## Required keys to be logged to the output
REQUIRED_KEYS = %w[
method path status duration user_agent accept request_id url message
method path status duration user_agent accept request_id request_url message
].freeze

## Optional keys to be ignored from the output for the time being
Expand All @@ -29,6 +29,8 @@ def call(severity, timestamp, _progname, raw_msg)
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
Expand Down
2 changes: 1 addition & 1 deletion lib/json_rails_logger/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module JsonRailsLogger
MAJOR = 1
MINOR = 0
PATCH = 1
PATCH = 2
SUFFIX = nil
VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}#{SUFFIX && ".#{SUFFIX}"}"
end

0 comments on commit 3d77909

Please sign in to comment.