Sha256: 4ea3c02d7c25f548acfb79a4f775a3b251f32e1d5238ba54cf63c4d267996b00

Contents?: true

Size: 626 Bytes

Versions: 18

Compression:

Stored size: 626 Bytes

Contents

module MongodbLogger
  # Change config options in an initializer:
  #
  # MongodbLogger::Base.on_log_exception do |mongo_record|
  #   ... call some code ... 
  # end
  #
  # Or in a block:
  #
  # MongodbLogger::Base.configure do |config|
  #   config.on_log_exception do |mongo_record|
  #     ... call some code ... 
  #   end
  # end

  module Config
    attr_accessor :on_log_exception

    def configure
      yield self
    end

    def on_log_exception(*args, &block)
      if block
        @on_log_exception = block
      elsif @on_log_exception
        @on_log_exception.call(*args)
      end 
    end
    
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mongodb_logger-0.6.1 lib/mongodb_logger/config.rb
mongodb_logger-0.6.0 lib/mongodb_logger/config.rb
mongodb_logger-0.5.2 lib/mongodb_logger/config.rb
mongodb_logger-0.5.1 lib/mongodb_logger/config.rb
mongodb_logger-0.5.0 lib/mongodb_logger/config.rb
mongodb_logger-0.4.2 lib/mongodb_logger/config.rb
mongodb_logger-0.4.1 lib/mongodb_logger/config.rb
mongodb_logger-0.4.0 lib/mongodb_logger/config.rb
mongodb_logger-0.3.3-jruby lib/mongodb_logger/config.rb
mongodb_logger-0.3.3 lib/mongodb_logger/config.rb
mongodb_logger-0.3.2-jruby lib/mongodb_logger/config.rb
mongodb_logger-0.3.2 lib/mongodb_logger/config.rb
mongodb_logger-0.3.1-jruby lib/mongodb_logger/config.rb
mongodb_logger-0.3.1 lib/mongodb_logger/config.rb
mongodb_logger-0.3.0-jruby lib/mongodb_logger/config.rb
mongodb_logger-0.3.0 lib/mongodb_logger/config.rb
mongodb_logger-0.2.8-jruby lib/mongodb_logger/config.rb
mongodb_logger-0.2.8 lib/mongodb_logger/config.rb