def call(sev, time, _, msg) #:nodoc:
      level = ({
          Logger::DEBUG   => 'DEBUG',
          Logger::INFO    => 'INFO',
          Logger::WARN    => 'WARN',
          Logger::ERROR   => 'ERROR',
          Logger::FATAL   => 'FATAL',
      }[sev] || sev.to_s).upcase

      if msg.present? && AUTO_DEBUG_PATTERNS.find{|pattern| msg =~ pattern}
        return '' if debug_skip?
        level = 'DEBUG'
      end

      if msg.present?
        # And we'll expand exceptions so we get as much info as possible.
        # If you just want the message, make sure you just pass the message.
        if msg.is_a?(::Exception)
          msg = "#{msg.message} (#{msg.class})\n#{(msg.backtrace || []).join("\n")}"
        elsif !msg.is_a?(::String)
          msg = msg.inspect
        end

        msg = rm_fmt msg

        {
            level: level,
            time: time.strftime('%Y-%m-%d %H:%M:%S'),
            message: msg,
            app_name: app_name,
            app_version: app_version,
            process_id: Process.pid,
        }.to_json + "\r\n"
      else
        ''
      end
    end
def call(sev, time, _, msg) #:nodoc:
      level = ({
          Logger::DEBUG   => 'DEBUG',
          Logger::INFO    => 'INFO',
          Logger::WARN    => 'WARN',
          Logger::ERROR   => 'ERROR',
          Logger::FATAL   => 'FATAL',
      }[sev] || sev.to_s).upcase

      if msg.present? && AUTO_DEBUG_PATTERNS.find{|pattern| msg =~ pattern}
        return '' if debug_skip?
        level = 'DEBUG'
      end

      if msg.present?
        # And we'll expand exceptions so we get as much info as possible.
        # If you just want the message, make sure you just pass the message.
        if msg.is_a?(::Exception)
          msg = "#{msg.message} (#{msg.class})\n#{(msg.backtrace || []).join("\n")}"
        elsif !msg.is_a?(::String)
          msg = msg.inspect
        end

        msg = rm_fmt msg

        {
            level: level,
            time: time.strftime('%Y-%m-%d %H:%M:%S'),
            message: msg,
            app_name: app_name,
            app_version: app_version,
            process_id: Process.pid,
        }.to_json + "\r\n"
      else
        ''
      end
    end
Overrides the default formatter behavior to log a JSON line.