Sha256: e8280a318e65899f623736bb7016400db602c92cc88838e943952b554ad47c64

Contents?: true

Size: 714 Bytes

Versions: 127

Compression:

Stored size: 714 Bytes

Contents

require 'logger'

module Jets
  class Logger < ::Logger
    # Only need to override the add method as the other calls all lead to it.
    def add(severity, message = nil, progname = nil)
      # Taken from Logger#add source
      # https://ruby-doc.org/stdlib-2.5.1/libdoc/logger/rdoc/Logger.html#method-i-add
      if message.nil?
        if block_given?
          message = yield
        else
          message = progname
          progname = @progname
        end
      end
      # Put the message in the Jets::IO.buffer which will get flushed to CloudWatch.
      # No need to include timestamp as CloudWatch already has a timestamp.
      IO.buffer << message

      super # original logical
    end
  end
end

Version data entries

127 entries across 127 versions & 2 rubygems

Version Path
jets-0.8.0 lib/jets/logger.rb
jets-0.7.1 lib/jets/logger.rb
jets-0.7.0 lib/jets/logger.rb
jets-0.6.9 lib/jets/logger.rb
jets-0.6.8 lib/jets/logger.rb
jets-0.6.7 lib/jets/logger.rb
jets-0.6.6 lib/jets/logger.rb