Sha256: 1f70459197342fe615fd4ba2211710a1f8f64311d6efc6b905a239e4449c6313

Contents?: true

Size: 491 Bytes

Versions: 4

Compression:

Stored size: 491 Bytes

Contents

module SimpleProfiler
  module Reporters
    class Logger

      def initialize(logger, options={})
        @options = options
        @logger = logger
      end

      def notify(event)
        logger.debug event.to_s if login?(event)
      end

      private

      attr_reader :logger
      attr_reader :options    

      def login?(event)
        event.total_time >= options.fetch(:min_time, 0) || 
        event.used_memory >= options.fetch(:min_memory, 0)
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_profiler-0.2.0 lib/simple_profiler/reporters/logger.rb
simple_profiler-0.1.2 lib/simple_profiler/reporters/logger.rb
simple_profiler-0.1.1 lib/simple_profiler/reporters/logger.rb
simple_profiler-0.1.0 lib/simple_profiler/reporters/logger.rb