Class: Lims::Core::Persistence::Logger::Store
- Defined in:
- lib/lims-core/persistence/logger/store.rb
Overview
An Logger::Store, a store ‘logging’ object instead of saving them.
Constant Summary
Constants inherited from Store
Store::DIRTY_ATTRIBUTE_STRATEGY_DEEP_COPY, Store::DIRTY_ATTRIBUTE_STRATEGY_MD5, Store::DIRTY_ATTRIBUTE_STRATEGY_QUICK_HASH, Store::DIRTY_ATTRIBUTE_STRATEGY_SHA1
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Attributes inherited from Store
Instance Method Summary collapse
-
#initialize(logger, method = :info, *args) ⇒ Store
constructor
Create a store with an underlying logger.
- #log(msg) ⇒ Object
Methods inherited from Store
#base_module, base_module, const_missing, #create_session, #transaction, #with_session
Constructor Details
#initialize(logger, method = :info, *args) ⇒ Store
Create a store with an underlying logger. send information to the logger.
22 23 24 25 26 27 28 29 |
# File 'lib/lims-core/persistence/logger/store.rb', line 22 def initialize(logger, method=:info, *args) @logger = case logger when ::Logger then logger else ::Logger.new(logger) end @method = method super(*args) end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
15 16 17 |
# File 'lib/lims-core/persistence/logger/store.rb', line 15 def logger @logger end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
16 17 18 |
# File 'lib/lims-core/persistence/logger/store.rb', line 16 def method @method end |
Instance Method Details
#log(msg) ⇒ Object
31 32 33 |
# File 'lib/lims-core/persistence/logger/store.rb', line 31 def log(msg) @logger.send(@method, msg) end |