Skip to content

Commit

Permalink
Switch to lograge.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpendragon committed Mar 23, 2018
1 parent 89b0e25 commit 8b466c9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ gem 'blacklight-oembed'
gem 'devise_invitable'
gem 'iso-639'
gem 'iiif-presentation'
gem 'rails_semantic_logger'
gem 'lograge'
gem 'logstash-event'
gem 'omniauth-cas'
gem 'sneakers'
gem 'open_uri_redirections'
Expand Down
14 changes: 8 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ GEM
rails (>= 4.2.0)
legato (0.7.0)
multi_json
lograge (0.9.0)
actionpack (>= 4)
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
logstash-event (1.2.02)
loofah (2.2.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
Expand Down Expand Up @@ -375,9 +381,6 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails_semantic_logger (4.2.0)
rails (>= 3.2)
semantic_logger (~> 4.1)
railties (5.0.6)
actionpack (= 5.0.6)
activesupport (= 5.0.6)
Expand Down Expand Up @@ -455,8 +458,6 @@ GEM
sdoc (0.4.2)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
semantic_logger (4.2.0)
concurrent-ruby (~> 1.0)
serverengine (1.5.11)
sigdump (~> 0.2.2)
sidekiq (4.2.2)
Expand Down Expand Up @@ -591,6 +592,8 @@ DEPENDENCIES
iso-639
jbuilder (~> 2.0)
jquery-rails
lograge
logstash-event
nokogiri (~> 1.8.1)
omniauth-cas
open_uri_redirections
Expand All @@ -602,7 +605,6 @@ DEPENDENCIES
pul_uv_rails!
rails (~> 5.0)
rails-controller-testing
rails_semantic_logger
redis-namespace
riiif
rsolr (~> 1.0.6)
Expand Down
5 changes: 0 additions & 5 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,5 @@ class Application < Rails::Application
# config.i18n.default_locale = :de

config.autoload_paths += %W(#{Rails.root}/app/workers)
config.semantic_logger.backtrace_level = :info
config.rails_semantic_logger.quiet_assets = true
config.rails_semantic_logger.format = :json
config.rails_semantic_logger.rendered = false
config.semantic_logger.application = 'DPUL'
end
end
14 changes: 14 additions & 0 deletions config/initializers/lograge.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true
Rails.application.configure do
# Lograge config
config.lograge.enabled = true

# We are asking here to log in RAW (which are actually ruby hashes). The Ruby logging is going to take care of the JSON formatting.
config.lograge.formatter = Lograge::Formatters::Logstash.new

# This is is useful if you want to log query parameters
config.lograge.custom_options = lambda do |event|
{ ddsource: ["ruby"],
params: event.payload[:params].reject { |k| %w[controller action].include? k } }
end
end

0 comments on commit 8b466c9

Please sign in to comment.