Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds option to silence request params logging #259

Merged
merged 4 commits into from
Feb 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
master
===
* [Optionally Silence Request Param Logging](https://github.com/bellycard/napa/pull/259)
* [Support Roar > 1.0](https://github.com/bellycard/napa/pull/242)
* [Move to CircleCI](https://github.com/bellycard/napa/pull/241)
* [Fix for Logging bug in :basic format](https://github.com/bellycard/napa/pull/222)
Expand Down
2 changes: 0 additions & 2 deletions lib/napa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

require 'napa/deprecations'
require 'napa/deploy'
require 'napa/gem_dependency'

# load rake tasks if Rake installed
if defined?(Rake)
Expand All @@ -53,7 +52,6 @@ module Napa
class << self
def initialize
return if Napa.skip_initialization
Napa::Logger.logger.info Napa::GemDependency.log_all if Napa.env.production?
Napa::Deprecations.initialization_checks
end
end
Expand Down
37 changes: 0 additions & 37 deletions lib/napa/gem_dependency.rb

This file was deleted.

21 changes: 11 additions & 10 deletions lib/napa/middleware/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ def format_request(env)
# do nothing, params is already set
end

request_data = {
method: request.request_method,
path: request.path_info,
query: filtered_query_string(request.query_string),
host: Napa::Identity.hostname,
pid: Napa::Identity.pid,
revision: Napa::Identity.revision,
params: filtered_parameters(params),
remote_ip: request.ip
}
request_data = {}.tap do |h|
h[:method] = request.request_method
h[:path] = request.path_info
h[:query] = filtered_query_string(request.query_string)
h[:host] = Napa::Identity.hostname
h[:pid] = Napa::Identity.pid
h[:revision] = Napa::Identity.revision
h[:params] = filtered_parameters(params) unless ENV['SILENCE_REQUEST_PARAMS_LOG'] == 'true'
h[:remote_ip] = request.ip
end

request_data[:user_id] = current_user.try(:id) if defined?(current_user)

Napa::Logger.request(request_data)
Expand Down