def add(severity, message = nil, progname = nil)
      severity = Severity.label_to_level(severity) if severity.is_a?(String) || severity.is_a?(Symbol)

      return unless severity && severity >= level

      time = Time.now
      if message.nil?
        if block_given?
          message = yield
        else
          message = progname
          progname = nil
        end
      end

      message = @_formatter.format(message)
      progname ||= self.progname
      entry = LogEntry.new(time, severity, message, progname, $$, Lumberjack.unit_of_work_id)
      begin
        device.write(entry)
      rescue => e
        $stderr.puts("#{e.class.name}: #{e.message}#{' at ' + e.backtrace.first if e.backtrace}")
        $stderr.puts(entry.to_s)
      end

      nil
    end
def add(severity, message = nil, progname = nil)
      severity = Severity.label_to_level(severity) if severity.is_a?(String) || severity.is_a?(Symbol)

      return unless severity && severity >= level

      time = Time.now
      if message.nil?
        if block_given?
          message = yield
        else
          message = progname
          progname = nil
        end
      end

      message = @_formatter.format(message)
      progname ||= self.progname
      entry = LogEntry.new(time, severity, message, progname, $$, Lumberjack.unit_of_work_id)
      begin
        device.write(entry)
      rescue => e
        $stderr.puts("#{e.class.name}: #{e.message}#{' at ' + e.backtrace.first if e.backtrace}")
        $stderr.puts(entry.to_s)
      end

      nil
    end
Add a message to the log with a given severity. The message can be either
 passed in the +message+ argument or supplied with a block. This method
 is not normally called. Instead call one of the helper functions
 +fatal+, +error+, +warn+, +info+, or +debug+.

 The severity can be passed in either as one of the Severity constants,
 or as a Severity label.

 === Example

   logger.add(Lumberjack::Severity::ERROR, exception)
   logger.add(Lumberjack::Severity::INFO, "Request completed")
   logger.add(:warn, "Request took a long time")
   logger.add(Lumberjack::Severity::DEBUG){"Start processing with options #{options.inspect}"}