BREAKING CHANGES
This version contains many breaking changes. Consider this when upgrading:
- Replace calls to
RailsApiLogger.new
withRailsApiLogger::Logger.new
. More in general the logger has been renamed. InboundRequestLog
has been renamed toRailsApiLogger::InboundRequestLog
. Table name did not change.OutboundRequestLog
has been renamed toRailsApiLogger::OutboundRequestLog
. Table name did not change.- If you had
has_many :inbound_request_logs
orhas_many :outbound_request_logs
defined, this will break. There's now three methods you can use on your model. InboundRequestsLoggerMiddleware
has been renamed toRailsApiLogger::Middleware
Do the changes above and then continue with the following steps if you want to connect rails_api_logger to a different database:
-
Specify a database called
api_logger
. Check here for an example. -
Check that everything still works (also in production!) with the new configuration.
-
Add the migrations in the right folder to create again the necessary tables. Run the migrations that will generate a new schema file.
-
Release and do the same in production. Adapt your build/release steps if you need.
-
Add the following line into
production.rb
:config.rails_api_logger.connects_to = { database: { writing: :api_logger } }
if you want to point to a new database.
If you are not on SQLite you can point also
api_logger
database to the current database you have, so you benefit from isolated transactions but don't need to create a new database or migrate data.
- Namespace correctly. Renamed all classes
- Added tests with a dummy app
- Use a separate database connection configuration to isolate transactions
- I acknowledge that there might be issues on mysql. I don't use it so I won't fix them, but PR are welcome.
- Added
host_regexp
option to the middleware.
- Add option skip_request_body to skip the request body. Use this option when you don't want to persist the request
body.
[Skipped]
will be persisted instead. - Add option skip_request_body_regexp to skip logging the body of requests matching a regexp.
- Renamed the option skip_body into skip_response_body. This is a breaking change!
- Renamed the option skip_body_regexp into skip_response_body_regexp. This is a breaking change!
- Fix Rails 7.1 warnings.
- Add option skip_body to skip the body for request responses. Use this option when you don't want to persist the
response body.
[Skipped]
will be persisted instead. This is not a breaking change.
- Fix an issue in the middleware where the request body was not read correctly if there were encoding issues.
- Improved documentation about outboud request logging.
- Add option skip_body_regexp to skip logging the body of requests matching a regexp.
- Fix the CHANGELOG path in gemspec.
- Fixes Zeitwerk warning.
- Fixes the loading of concern into controllers.
- Fixes an important concurrency issue by removing instance variables in the rack middleware.
- Started using Zeitwerk.
- Removed RailsAdmin specific code.
- Improved RailsApiLogger class.
- Fixed the
.failed
scope.
- Added
started_at
,ended_at
andduration
methods.
Migrate your tables with:
add_column :inbound_request_logs, :started_at, :timestamp
add_column :inbound_request_logs, :ended_at, :timestamp
add_column :outbound_request_logs, :started_at, :timestamp
add_column :outbound_request_logs, :ended_at, :timestamp
- Added
formatted_request_body
andformatted_response_body
methods.
- Switch to a middleware solution.
- Initial release.