lib/ezlog/railtie.rb in ezlog-0.3.5 vs lib/ezlog/railtie.rb in ezlog-0.4.0
- old
+ new
@@ -1,30 +1,39 @@
module Ezlog
class Railtie < Rails::Railtie
+ initializer "ezlog.initialize" do
+ require "ezlog/rails/extensions"
+ end
+
initializer 'ezlog.configure_logging' do |app|
::Logging.logger.root.appenders = ::Logging.appenders.stdout 'stdout', layout: Ezlog::LoggingLayout.new(environment: ::Rails.env)
::Logging.logger.root.level = app.config.log_level
end
- initializer 'ezlog.configure_sidekiq_logging' do |app|
+ initializer 'ezlog.configure_sidekiq' do |app|
initialize_sidekiq_logging(app) if defined? ::Sidekiq
end
- initializer 'ezlog.configure_rack_timeout_logging' do
+ initializer 'ezlog.configure_sequel' do
+ ::Sequel::Database.extension :ezlog_logging if defined? ::Sequel
+ end
+
+ initializer 'ezlog.configure_rack_timeout' do
disable_rack_timeout_logging if defined? ::Rack::Timeout
end
- initializer 'ezlog.configure_middlewares' do |app|
+ initializer 'ezlog.configure_rails_middlewares' do |app|
app.config.middleware.insert_after ::ActionDispatch::RequestId, Ezlog::Rails::RequestLogContext
app.config.middleware.delete ::Rails::Rack::Logger
- app.config.middleware.swap ::ActionDispatch::DebugExceptions, Ezlog::Rails::DebugExceptions
- app.config.middleware.insert_before Ezlog::Rails::DebugExceptions, Ezlog::Rails::AccessLog, Ezlog.logger('AccessLog')
- app.config.middleware.insert_after Ezlog::Rails::DebugExceptions, Ezlog::Rails::LogExceptions, Ezlog.logger('Application')
+ app.config.middleware.insert_before ::ActionDispatch::DebugExceptions, Ezlog::Rails::AccessLog, Ezlog.logger('AccessLog')
+ app.config.middleware.insert_after ::ActionDispatch::DebugExceptions, Ezlog::Rails::LogExceptions, Ezlog.logger('Application')
end
config.after_initialize do
Ezlog::Rails::LogSubscriber.detach ::ActionController::LogSubscriber
Ezlog::Rails::LogSubscriber.detach ::ActionView::LogSubscriber
+ Ezlog::Rails::LogSubscriber.detach ::ActiveRecord::LogSubscriber
+ Ezlog::Rails::LogSubscriber.attach Ezlog::Rails::ActiveRecord::LogSubscriber, :active_record
end
config.before_configuration do |app|
app.config.logger = Ezlog.logger('Application')
app.config.log_level = ENV['LOG_LEVEL'] || :info