Class: Rlyeh::DeepOnes::Logger
- Inherits:
-
Object
- Object
- Rlyeh::DeepOnes::Logger
- Includes:
- Logger
- Defined in:
- lib/rlyeh/deep_ones/logger.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, logger = nil, level = :debug) ⇒ Logger
constructor
A new instance of Logger.
- #write(env) ⇒ Object
Methods included from Logger
Constructor Details
#initialize(app, logger = nil, level = :debug) ⇒ Logger
Returns a new instance of Logger.
8 9 10 11 12 |
# File 'lib/rlyeh/deep_ones/logger.rb', line 8 def initialize(app, logger = nil, level = :debug) @app = app @logger = logger || self @level = level end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 |
# File 'lib/rlyeh/deep_ones/logger.rb', line 14 def call(env) write env @app.call env if @app end |
#write(env) ⇒ Object
19 20 21 |
# File 'lib/rlyeh/deep_ones/logger.rb', line 19 def write(env) @logger.__send__ @level, "Message received: #{env.data}" end |