Skip to content

Commit

Permalink
Merge pull request #39 from SumOfUs/lograge-logging
Browse files Browse the repository at this point in the history
Uses Lograge for logging, so the log output style is the same as in Champaign and will hit the same log filters on Papertrail.
  • Loading branch information
NealJMD committed Feb 24, 2016
2 parents 0c93f33 + aaafd66 commit 7f60975
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ gem 'aws-sdk'

# For pushing out updates after processing an event.
gem 'pusher'
gem 'lograge'

group :development, :test do
gem 'byebug'
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ deployment:
- docker push soutech/champaign-ak-processor
- ./deploy.sh $CIRCLE_SHA1 'champaign' 'ak-worker-production' 'logs3.papertrailapp.com:44107'
staging:
branch: development
branch: lograge-logging
commands:
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker push soutech/champaign-ak-processor
Expand Down
16 changes: 13 additions & 3 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,19 @@
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
config.log_level = :info
config.lograge.enabled = true

config.lograge.custom_options = lambda do |event|
params = event.payload[:params].reject do |k|
['controller', 'action'].include? k
end
log_hash = {"params"=> params, "time"=>event.time}
if event.payload[:exception].present?
log_hash["exception"] = event.payload[:exception]
end
log_hash
end

# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
Expand Down

0 comments on commit 7f60975

Please sign in to comment.