Sha256: f216c6e0db3d6a5aae5bb188ed8864f6d7f24b860775f1735fc56f9fbe5e830b

Contents?: true

Size: 595 Bytes

Versions: 1

Compression:

Stored size: 595 Bytes

Contents

module Proselytism
  module Shared

    def log(severity, message = nil)
      config.logger.send(severity, message) if config.logger
    end

    def log_with_time(severity, message = nil, &block)
      start_time = Time.now
      delay = nil
      if block_given?
        result = yield
        delay = "(#{((Time.now - start_time)*1000).to_i} ms) "
      end
      message= "** Proselytism #{start_time.strftime("%Y-%m-%d %H:%M:%S")} #{delay}: " + message.to_s
      log_without_time(severity, message)
      block_given? ? result : true
    end
    alias_method_chain :log, :time

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
proselytism-0.0.1 lib/proselytism/shared.rb