Skip to content

Commit

Permalink
Merge pull request #184 from datacite/reimplement-logging
Browse files Browse the repository at this point in the history
reconfigure logging
  • Loading branch information
wendelfabianchinsamy authored May 21, 2024
2 parents d775f34 + f86d61d commit 7b7f977
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
13 changes: 6 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "https://rubygems.org"

gem "rails", "~> 7.1", ">= 7.1.3"
gem "bootsnap", "~> 1.4"
gem "bootsnap", "~> 1.4", ">= 1.4.4", require: false
gem "mysql2", "~> 0.5.3"
gem "dotenv"
gem "oj", ">= 2.8.3"
Expand All @@ -11,7 +11,7 @@ gem "nokogiri", "~> 1.16", ">= 1.16.4"
gem "iso8601", "~> 0.12.1"
gem "maremma", "~> 5.0"
gem "dalli", "~> 3.2", ">= 3.2.8"
gem "lograge", "~> 0.11.2"
gem "lograge", "~> 0.14.0"
gem "logstash-event", "~> 1.2", ">= 1.2.02"
gem "logstash-logger", "~> 0.26.1"
gem "active_model_serializers", "~> 0.10.10"
Expand All @@ -35,11 +35,11 @@ gem "sprockets", "~> 3.7", ">= 3.7.2"
gem "kt-paperclip", "~> 6.4.1"

group :development, :test do
gem "rspec-rails", "~> 3.8"
gem "rubocop-rspec", "~> 1.35"
gem "rubocop", "~> 0.77.0"
gem "rspec-rails", "~> 6.1", ">= 6.1.1"
gem "rubocop-rspec", "~> 2.0", require: false
gem "rubocop", "~> 1.3", ">= 1.3.1"
gem "rubocop-performance", "~> 1.5", ">= 1.5.1"
gem "rubocop-rails", "~> 2.4"
gem "rubocop-rails", "~> 2.8", ">= 2.8.1"
gem "binding_of_caller"
gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
end
Expand All @@ -48,7 +48,6 @@ group :development do
gem "listen", "~> 3.9"
gem "spring"
gem "spring-watcher-listen", "~> 2.0.0"
gem "httplog", "~> 1.3"
end

group :test do
Expand Down
9 changes: 5 additions & 4 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ class Application < Rails::Application
config.logger = config.lograge.logger
config.log_level = ENV["LOG_LEVEL"].to_sym

config.lograge.ignore_actions = ["HeartbeatController#index", "IndexController#index"]
config.lograge.ignore_custom = lambda do |event|
event.payload.inspect.length > 100000
end
# config.lograge.ignore_actions = ["HeartbeatController#index", "IndexController#index"]
# config.lograge.ignore_custom = lambda do |event|
# event.payload.inspect.length > 100000
# end

config.lograge.base_controller_class = "ActionController::API"

config.lograge.custom_options = lambda do |event|
Expand Down
7 changes: 0 additions & 7 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
config.action_controller.perform_caching = true
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"], { namespace: ENV["APPLICATION"] }

HttpLog.configure do |config|
config.enabled = false
config.logger = LogStashLogger.new(type: :stdout)
config.url_blacklist_pattern = /sqs\.eu-west-1\.amazonaws\.com/
config.filter_parameters = %w(client_id access_token orcid_token)
end

# Don't care if the mailer can't send.
# config.action_mailer.raise_delivery_errors = false

Expand Down
6 changes: 3 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
root :to => 'index#index'
resources :heartbeat, only: [:index]
resources :index, path: '/', only: [:index]
# resources :index, only: [:index]

def add_swagger_route http_method, path, opts = {}
full_path = path.gsub(/{(.*?)}/, ':\1')
match full_path, to: "#{opts.fetch(:controller_name)}##{opts[:action_name]}", via: http_method
end

# add_swagger_route 'GET', '//reports/publishers', controller_name: 'publishers', action_name: 'index'
add_swagger_route 'DELETE', '//publishers/{id}', controller_name: 'publishers', action_name: 'destroy'
add_swagger_route 'PUT', '//publishers/{id}', controller_name: 'publishers', action_name: 'update'
add_swagger_route 'POST', '//publishers', controller_name: 'publishers', action_name: 'create'
Expand All @@ -25,7 +23,9 @@ def add_swagger_route http_method, path, opts = {}

get 'repositories-usage-reports/:id', :to => 'publishers#show', constraints: { :id => /.+/ }


resources :publishers, constraints: { :id => /.+/ }, format: false, defaults: { format: false }
resources :repositories_usage_reports, constraints: { :id => /.+/ }, format: false, defaults: { format: false }

get '/public/favicon.ico', to: redirect('/public/favicon.ico')
get '/favicon.ico', to: redirect('/public/favicon.ico')
end
Binary file added public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7b7f977

Please sign in to comment.