Module: MongodbLogger::Config

Extended by:
Config
Included in:
Base, Config
Defined in:
lib/mongodb_logger/config.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#disabledObject



32
33
34
# File 'lib/mongodb_logger/config.rb', line 32

def disabled
  @disabled ||= false
end

#on_log_exception(*args, &block) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/mongodb_logger/config.rb', line 24

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

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



20
21
22
# File 'lib/mongodb_logger/config.rb', line 20

def configure
  yield self
end