def add(severity, msg = nil, progname = nil)
      severity = severity ? Integer(severity) : UNKNOWN
      return if @level > severity

      progname ||= @progname
      if msg.nil?
        if block_given?
          msg = yield
        else
          msg = progname
          progname = @progname
        end
      end

      case msg
      when Hash, Rackstash::Fields::Hash
        buffer.add_fields(msg)
      else
        time = Time.now.utc.freeze
        buffer.add_message Message.new(
          formatter.call(Rackstash.severity_label(severity), time, progname, msg),
          time: time,
          progname: progname,
          severity: severity
        )
      end
    end
def add(severity, msg = nil, progname = nil)
      severity = severity ? Integer(severity) : UNKNOWN
      return if @level > severity

      progname ||= @progname
      if msg.nil?
        if block_given?
          msg = yield
        else
          msg = progname
          progname = @progname
        end
      end

      case msg
      when Hash, Rackstash::Fields::Hash
        buffer.add_fields(msg)
      else
        time = Time.now.utc.freeze
        buffer.add_message Message.new(
          formatter.call(Rackstash.severity_label(severity), time, progname, msg),
          time: time,
          progname: progname,
          severity: severity
        )
      end
    end
Log a message if the given severity is high enough. This is the generic
 logging method. Users will be more inclined to use {#debug}, {#info},
 {#warn}, {#error}, or {#fatal}.

 The message will be added to the current log buffer. If we are currently
 buffering (i.e. if we are inside a {#capture} block), the message is
 merely added but not flushed to the underlying logger. Else, the message
 along with any previously defined fields and tags will be flushed to the
 base logger immediately.

 @param severity [Integer] The log severity. One of the {SEVERITIES}
   constants.
 @param msg [#to_s, ::Hash, Exception, nil] The log message. If unset, we
   try, to use the return value of the optional block. If we get a `String`
   or `Exception`, we log a new {Message}. If it's a Hash, we deep_merge it
   into the current buffer's fields instead.
 @param progname [String, nil] The program name. Can be omitted. It's
   treated as a message if no `msg` and `block` are given.
 @yield If `message` is `nil`, we yield to the block to get a message
   string.
 @return [Message, ::Hash, nil] The merged Hash, or the resolved {Message}
   or `nil` if nothing was logged