Skip to content

Commit

Permalink
Add lograge to tidy up logging when rendering actions
Browse files Browse the repository at this point in the history
  • Loading branch information
malparty committed Nov 10, 2023
1 parent aeb25a9 commit ab4abf8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .template/spec/base/config/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
expect(subject).to contain('config.active_job.queue_name_prefix = Rails.env')
end

it 'enables lograge' do
expect(subject).to contain('config.lograge.enabled = true')
end

it 'configures the middleware for rack deflater' do
expect(subject).to contain('config.middleware.use Rack::Deflater')
end
Expand Down
1 change: 1 addition & 0 deletions Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ group :development, :test do
gem 'figjam' # ENV configuration for ruby using yaml files
gem 'listen' # Listens to file modifications
gem 'letter_opener' # Preview mail in the browser instead of sending
gem 'lograge' # Taming Rails' Default Request Logging
gem 'ffaker' # A library for generating fake data such as names, addresses, and phone numbers
gem 'fabrication' # Fabrication generates objects in Ruby. Fabricators are schematics for your objects, and can be created as needed anywhere in your app or specs

Expand Down
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# Prefix the queue name of all jobs with Rails ENV
config.active_job.queue_name_prefix = Rails.env
# Single line logs for Action Rendering
config.lograge.enabled = true
# Compress the responses to reduce the size of html/json controller responses.
config.middleware.use Rack::Deflater
RUBY
Expand Down
1 change: 0 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

insert_into_file 'config/environments/development.rb', before: /^end/ do
<<~RUBY.indent(2)
# Configure Bullet gem to detect N+1 queries
config.after_initialize do
Bullet.enable = true
Expand Down

0 comments on commit ab4abf8

Please sign in to comment.