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-1.9.7 lib/jets/logger.rb
jets-1.9.6 lib/jets/logger.rb
jets-1.9.5 lib/jets/logger.rb
jets-1.9.4 lib/jets/logger.rb
jets-1.9.3 lib/jets/logger.rb
jets-1.9.2 lib/jets/logger.rb
jets-1.9.1 lib/jets/logger.rb
jets-1.9.0 lib/jets/logger.rb
jets-1.8.14 lib/jets/logger.rb
jets-1.8.13 lib/jets/logger.rb
jets-1.8.12 lib/jets/logger.rb
jets-1.8.11 lib/jets/logger.rb
jets-1.8.10 lib/jets/logger.rb
jets-1.8.9 lib/jets/logger.rb
jets-1.8.8 lib/jets/logger.rb
jets-1.8.7 lib/jets/logger.rb
jets-1.8.6 lib/jets/logger.rb
jets-1.8.5 lib/jets/logger.rb
jets-1.8.4 lib/jets/logger.rb
jets-1.8.3 lib/jets/logger.rb