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.
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
46 47 |
# File 'lib/fluent/logger/test_logger.rb', line 46 def close end |
#post_with_time(tag, map, time) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fluent/logger/test_logger.rb', line 30 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
42 43 44 |
# File 'lib/fluent/logger/test_logger.rb', line 42 def tag_queue(tag) @queue.find_all {|map| map.tag == tag } end |