Sha256: 5977d8f6b50cc87bde59a38c6b852cb3da2b725df74c893acf01897ad1b3bc1a
Contents?: true
Size: 1.48 KB
Versions: 7
Compression:
Stored size: 1.48 KB
Contents
module Logster::Rails # this magically registers logster.js in the asset pipeline class Engine < Rails::Engine end def self.set_logger(config) return unless Logster.config.environments.include?(Rails.env.to_sym) require 'logster/middleware/debug_exceptions' require 'logster/middleware/reporter' store = Logster.store ||= Logster::RedisStore.new store.level = Logger::Severity::WARN if Rails.env.production? logger = Logster::Logger.new(store) logger.chain(::Rails.logger) logger.level = ::Rails.logger.level Logster.logger = ::Rails.logger = config.logger = logger end def self.initialize!(app) return unless Logster.config.environments.include?(Rails.env.to_sym) if Logster::Logger === Rails.logger app.middleware.insert_before ActionDispatch::ShowExceptions, Logster::Middleware::Reporter if Rails::VERSION::MAJOR == 3 app.middleware.insert_before ActionDispatch::DebugExceptions, Logster::Middleware::DebugExceptions else app.middleware.insert_before ActionDispatch::DebugExceptions, Logster::Middleware::DebugExceptions, Rails.application end app.middleware.delete ActionDispatch::DebugExceptions app.config.colorize_logging = false end end class Railtie < ::Rails::Railtie config.before_initialize do Logster::Rails.set_logger(config) end initializer "logster.configure_rails_initialization" do |app| Logster::Rails.initialize!(app) end end end
Version data entries
7 entries across 7 versions & 1 rubygems