Sha256: 6a4d26642daab4ae7f9ec3df3ca036374ebbbb144e1674b71130fd537c3a362b

Contents?: true

Size: 368 Bytes

Versions: 1

Compression:

Stored size: 368 Bytes

Contents

#encoding: utf-8
module SimplestBenchmarkLogger

  def log(msg)
    rails_app ? logger.debug(msg) : custom_logger.write("#{msg}\n")
  end

  def logger
    @logger ||= rails_app ? Rails.logger : custom_logger
  end

  def custom_logger
    @custom_logger ||= File.open("simplest_benchmark.log", "a")
  end

  def rails_app
    @rails_app ||= defined?(Rails)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simplest_benchmark-0.0.3 lib/simplest_benchmark_logger.rb