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_with_time(tag, map, time) ⇒ Object
- #tag_queue(tag) ⇒ Object
Methods inherited from LoggerBase
Constructor Details
#initialize(queue = []) ⇒ TestLogger
Returns a new instance of TestLogger.
21 22 23 24 |
# File 'lib/fluent/logger/test_logger.rb', line 21 def initialize(queue=[]) @queue = queue @max = 1024 end |
Instance Attribute Details
#max ⇒ Object
Returns the value of attribute max.
26 27 28 |
# File 'lib/fluent/logger/test_logger.rb', line 26 def max @max end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
27 28 29 |
# File 'lib/fluent/logger/test_logger.rb', line 27 def queue @queue end |
Instance Method Details
#close ⇒ Object
45 46 |
# File 'lib/fluent/logger/test_logger.rb', line 45 def close end |
#post_with_time(tag, map, time) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fluent/logger/test_logger.rb', line 29 def post_with_time(tag, map, time) 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 |
#tag_queue(tag) ⇒ Object
41 42 43 |
# File 'lib/fluent/logger/test_logger.rb', line 41 def tag_queue(tag) @queue.find_all {|map| map.tag == tag } end |