Sha256: b2e42289857f4b2b70d303502e222984ac0dc1047917ca47fcb6b18eed350e18
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
require 'mongo_request_logger/ext/activesupport_logger' require 'mongo_request_logger/ext/logger' require 'mongo_request_logger/logger' require 'mongo_request_logger/version' require 'mongo_request_logger/rack' if defined?(Rails) require 'mongo_request_logger/railtie' end require 'mongoid' require 'mongo' require_relative './mongo_request_logger/adapters/mongo.rb' module MongoRequestLogger def self.session @session end def self.configure(options={}) require 'mongo_request_logger/rack' require 'mongo_request_logger/viewer' environment = ENV['RACK_ENV'] || ENV['RAILS_ENV'] session = Mongoid.client(:logger) if session log_config = Mongoid.clients[:logger][:options].with_indifferent_access fallback_log = options[:fallback_log] || log_config['fallback_log'] || "log/#{environment}.log" adapter = MongoRequestLogger::Adapters::Mongo.new(session, log_config) @session = session MongoRequestLogger::Viewer.adapter = adapter logger = MongoRequestLogger::Logger.new adapter, fallback_log else fallback_log = options[:fallback_log] || "log/#{environment}.log" logger = ::Logger.new(fallback_log) end MongoRequestLogger::Rack.logger = logger MongoRequestLogger::Rack.ignore_prefixes << '/assets' MongoRequestLogger::Rack.ignore_prefixes << '/favicon.ico' logger end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongo_request_logger-0.8.0 | lib/mongo_request_logger.rb |
mongo_request_logger-0.7.0 | lib/mongo_request_logger.rb |