class Lumberjack::Device::Writer
def write(entry)
-
(void)
-
Parameters:
-
entry
(LogEntry, String
) -- The entry to write to the stream.
def write(entry) string = (entry.is_a?(LogEntry) ? @template.call(entry) : entry) return if string.nil? string = string.strip return if string.length == 0 unless string.encoding == Encoding::UTF_8 string = string.encode("UTF-8", invalid: :replace, undef: :replace) end if buffer_size > 1 @lock.synchronize do @buffer << string end flush if @buffer.size >= buffer_size else flush if respond_to?(:before_flush, true) write_to_stream(string) end end