Class: Dokkit::Logging::Observer::Console
- Inherits:
-
Object
- Object
- Dokkit::Logging::Observer::Console
- Defined in:
- lib/dokkit/logging/observers/console.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(logger) ⇒ Console
constructor
A new instance of Console.
- #update ⇒ Object
Constructor Details
#initialize(logger) ⇒ Console
Returns a new instance of Console.
25 26 27 28 |
# File 'lib/dokkit/logging/observers/console.rb', line 25 def initialize(logger) @logger = logger @logger.attach(self) end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
23 24 25 |
# File 'lib/dokkit/logging/observers/console.rb', line 23 def logger @logger end |
Class Method Details
Instance Method Details
#update ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dokkit/logging/observers/console.rb', line 30 def update case [:level] when Logging::ERROR fail "[#{Time.now.asctime}][ERROR] #{[:text]}" when Logging::WARNING warn "[#{Time.now.asctime}][WARNING] #{[:text]}" when Logging::INFO puts "[#{Time.now.asctime}][INFO] #{[:text]}" when Logging::DEBUG puts "[#{Time.now.asctime}][DEBUG] #{[:text]}" end end |