Sha256: 72f5fdd8d07ba56be4367a7a57e459fb8d72c5afb011c2f3ce62a3811cabcb19

Contents?: true

Size: 754 Bytes

Versions: 3

Compression:

Stored size: 754 Bytes

Contents

module Jersey
  module Logging
    # always log the time
    module LogTime
      def log(hash = {})
        super(hash.merge(now: Time.now))
      end
    end
    # only log the first ten lines of a backtrace so error logs
    # are digestible
    module LogError
      def log(loggable = {})
        case loggable
        when Hash
          super(loggable)
        when Exception
          e = loggable
          super(error: true, id: e.object_id, message: e.message)
          lineno = 0
          e.backtrace[0,10].each do |line|
            lineno += 1
            super(error: true,
                  id: e.object_id,
                  backtrace: line,
                  line_number: lineno)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jersey-0.2.0 lib/jersey/logging/mixins.rb
jersey-0.1.0 lib/jersey/logging/mixins.rb
jersey-0.0.3 lib/jersey/logging/mixins.rb