Sha256: 52daa5fd06d507be9255ea7630048c4fc686ad54be913dec0977de85a54bb7af

Contents?: true

Size: 985 Bytes

Versions: 39

Compression:

Stored size: 985 Bytes

Contents

# encoding: utf-8

# Base class for startup logging and testing in multiverse

module OneApm
  module Logger
    class MemoryLogger
      def initialize
        @messages = []
      end

      def is_startup_logger?
        true
      end

      attr_accessor :messages, :level

      def fatal(*msgs, &blk)
        messages << [:fatal, msgs, blk]
      end

      def error(*msgs, &blk)
        messages << [:error, msgs, blk]
      end

      def warn(*msgs, &blk)
        messages << [:warn, msgs, blk]
      end

      def info(*msgs, &blk)
        messages << [:info, msgs, blk]
      end

      def debug(*msgs, &blk)
        messages << [:debug, msgs, blk]
      end

      def log_exception(level, e, backtrace_level=level)
        messages << [:log_exception, [level, e, backtrace_level]]
      end

      def dump(logger)
        messages.each do |(method, args, blk)|
          logger.send(method, *args, &blk)
        end
        messages.clear
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
oneapm_rpm-1.4.2 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.4.1 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.4.0 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.7 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.7.rc1 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.6 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.6.rc1 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.5 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.5.rc1 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.4 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.4.rc1 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.3 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.3.rc1 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.2 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.2.rc1 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.1 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.1.rc1 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.0 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.3.0.rc1 lib/one_apm/logger/memory_logger.rb
oneapm_rpm-1.2.9 lib/one_apm/logger/memory_logger.rb