vendor/bundle/ruby/2.6.0/gems/lumberjack-1.2.8/lib/lumberjack/device/writer.rb
# Write an entry to the stream. The entry will be converted into a string using the defined template.
Write an entry to the stream. The entry will be converted into a string using the defined template.
Write an entry to the stream . The entry will be converted into a string using the defined template .
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
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
Write an entry to the stream.
Write an entry to the stream .
entry