Class: Moneta::Logger::Format
- Inherits:
-
Object
- Object
- Moneta::Logger::Format
- Defined in:
- lib/moneta/logger.rb
Overview
Standard formatter used by the logger
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(options) ⇒ Format
constructor
A new instance of Format.
- #log(entry) ⇒ Object
Constructor Details
#initialize(options) ⇒ Format
Returns a new instance of Format.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/moneta/logger.rb', line 8 def initialize() @prefix = [:prefix] || 'Moneta ' if [:file] @close = true @out = File.open([:file], 'a') else @close = [:close] @out = [:out] || STDOUT end end |
Instance Method Details
#close ⇒ Object
23 24 25 |
# File 'lib/moneta/logger.rb', line 23 def close @out.close if @close end |
#log(entry) ⇒ Object
19 20 21 |
# File 'lib/moneta/logger.rb', line 19 def log(entry) @out.write(format(entry)) end |