def flush
      return self if @buffer.empty?

      str = nil
      sync {
        str = @buffer.join
        @buffer.clear
      }

      canonical_write str unless str.empty?
      self
    end
def flush
      return self if @buffer.empty?

      str = nil
      sync {
        str = @buffer.join
        @buffer.clear
      }

      canonical_write str unless str.empty?
      self
    end
Call +flush+ to force an appender to write out any buffered log events.
 Similar to IO#flush, so use in a similar fashion.