Class: Fluent::Logger::TestLogger
- Inherits:
-
LoggerBase
- Object
- LoggerBase
- Fluent::Logger::TestLogger
- Defined in:
- lib/fluent/logger/test_logger.rb
Instance Attribute Summary collapse
-
#max ⇒ Object
Returns the value of attribute max.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(queue = []) ⇒ TestLogger
constructor
A new instance of TestLogger.
- #post(tag, map, time = nil) ⇒ Object
Methods inherited from LoggerBase
Constructor Details
#initialize(queue = []) ⇒ TestLogger
Returns a new instance of TestLogger.
22 23 24 25 |
# File 'lib/fluent/logger/test_logger.rb', line 22 def initialize(queue=[]) @queue = queue @max = 1024 end |
Instance Attribute Details
#max ⇒ Object
Returns the value of attribute max.
27 28 29 |
# File 'lib/fluent/logger/test_logger.rb', line 27 def max @max end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
28 29 30 |
# File 'lib/fluent/logger/test_logger.rb', line 28 def queue @queue end |
Instance Method Details
#close ⇒ Object
42 43 |
# File 'lib/fluent/logger/test_logger.rb', line 42 def close end |
#post(tag, map, time = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fluent/logger/test_logger.rb', line 30 def post(tag, map, time=nil) while @queue.size > @max-1 @queue.shift end (class<<map;self;end).module_eval do define_method(:tag) { tag } define_method(:time) { time } end @queue << map true end |