Sha256: cc86e32de1ffebd75b28fca7baba4fb9153424ad0cbec438012c45f8dcd647e9
Contents?: true
Size: 818 Bytes
Versions: 3
Compression:
Stored size: 818 Bytes
Contents
require "logger" require 'bloat_check/version' require 'bloat_check/stats' require 'bloat_check/wrap_requests' module BloatCheck def self.disabled? return true if @disabled end def self.disable=(val) @disabled = val end def self.logger=(logger) @logger = logger end def self.logger return @logger if @logger return Rails.logger if defined? Rails @logger ||= Logger.new(STDERR).tap { |logger| logger.formatter = proc do |severity, datetime, progname, msg| "#{msg}\n" end } end def self.log(message) return block_given? && yield if disabled? start = Stats.get if block_given? begin ret = yield ensure (Stats.get - start).log(message) end ret else start.log(message) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bloat_check-0.0.5 | lib/bloat_check.rb |
bloat_check-0.0.4 | lib/bloat_check.rb |
bloat_check-0.0.3 | lib/bloat_check.rb |