def auto_event(message = nil)
      event = fields.to_h
      event[FIELD_TAGS] = tags.to_a

      if message
        event[FIELD_MESSAGE] = [message]

        time = message.time
        time = time.getutc.freeze unless time.utc? && time.frozen?
        event[FIELD_TIMESTAMP] = time
      else
        event[FIELD_MESSAGE] = []
        event[FIELD_TIMESTAMP] = Time.now.utc.freeze
      end

      event
    end
def auto_event(message = nil)
      event = fields.to_h
      event[FIELD_TAGS] = tags.to_a

      if message
        event[FIELD_MESSAGE] = [message]

        time = message.time
        time = time.getutc.freeze unless time.utc? && time.frozen?
        event[FIELD_TIMESTAMP] = time
      else
        event[FIELD_MESSAGE] = []
        event[FIELD_TIMESTAMP] = Time.now.utc.freeze
      end

      event
    end
Creates the automatically flushed event hash. It is similar to the one
 created by {#event} but only uses the passed `message` instead of all
 {#messages} and uses either the `message`'s timestamp or the current time
 but never the current Buffer's timestamp.

 This event is used to represent an intermediate state of a Buffer which
 can be flushed to interested flows early.

 @param message [Message, nil] The currently logged message which is added
   to the auto_event Hash. If kept empty (i.e. with `nil`), we do not
   add any messages.
 @return [Hash] the event Hash for the currently added data.
 @see #event