This processor simply queues up log entries for later use.
Create a queue.
Recognized options include:
:limit
Size limit for the queue. If not specified, the queue can grow arbitrarily large.
:drop_oldest
If set to true, then when an item is added to a full queue, the oldest item is dropped. If set to false or not specified, then the new item is not added.
# File lib/sawmill/entry_processor/simple_queue.rb, line 60 def initialize(opts_={}) @queue = Util::Queue.new(opts_) @closed = false end
# File lib/sawmill/entry_processor/simple_queue.rb, line 102 def attribute(entry_) @queue.enqueue(entry_) unless @closed !@closed end
# File lib/sawmill/entry_processor/simple_queue.rb, line 87 def begin_record(entry_) @queue.enqueue(entry_) unless @closed !@closed end
Return the oldest entry in the queue, or nil if the queue is empty.
# File lib/sawmill/entry_processor/simple_queue.rb, line 68 def dequeue @queue.dequeue end
Return an array of the contents of the queue, in order.
# File lib/sawmill/entry_processor/simple_queue.rb, line 75 def dequeue_all @queue.dequeue_all end
# File lib/sawmill/entry_processor/simple_queue.rb, line 92 def end_record(entry_) @queue.enqueue(entry_) unless @closed !@closed end
# File lib/sawmill/entry_processor/simple_queue.rb, line 112 def finish @closed = true nil end
# File lib/sawmill/entry_processor/simple_queue.rb, line 97 def message(entry_) @queue.enqueue(entry_) unless @closed !@closed end
Return the size of the queue, which is 0 if the queue is empty.
# File lib/sawmill/entry_processor/simple_queue.rb, line 82 def size @queue.size end
# File lib/sawmill/entry_processor/simple_queue.rb, line 107 def unknown_data(entry_) @queue.enqueue(entry_) unless @closed !@closed end