Module: Dynamoid::Config
- Includes:
- ActiveModel::Observing
- Included in:
- Config
- Defined in:
- lib/dynamoid/config.rb,
lib/dynamoid/config/options.rb
Overview
:nodoc
Defined Under Namespace
Modules: Options
Instance Method Summary collapse
-
#default_logger ⇒ Object
The default logger for Dynamoid: either the Rails logger or just stdout.
-
#logger ⇒ Object
Returns the assigned logger instance.
-
#logger=(logger) ⇒ Object
If you want to, set the logger manually to any output you’d like.
Methods included from Options
defaults, option, reset, settings
Instance Method Details
#default_logger ⇒ Object
The default logger for Dynamoid: either the Rails logger or just stdout.
33 34 35 |
# File 'lib/dynamoid/config.rb', line 33 def default_logger defined?(Rails) && Rails.respond_to?(:logger) ? Rails.logger : ::Logger.new($stdout) end |
#logger ⇒ Object
Returns the assigned logger instance.
40 41 42 |
# File 'lib/dynamoid/config.rb', line 40 def logger @logger ||= default_logger end |
#logger=(logger) ⇒ Object
If you want to, set the logger manually to any output you’d like. Or pass false or nil to disable logging entirely.
47 48 49 50 51 52 53 54 |
# File 'lib/dynamoid/config.rb', line 47 def logger=(logger) case logger when false, nil then @logger = nil when true then @logger = default_logger else @logger = logger if logger.respond_to?(:info) end end |