Sha256: dc2d15eeeb1d642b6a9204ab99052985c1e5af6488c13299a91982e5a887d06e
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
require 'logger' require 'quandl/logger/version' require "active_support" require "active_support/inflector" require "active_support/core_ext/hash" require "active_support/core_ext/object" require 'quandl/logger/graylog2' module Quandl class Logger class << self delegate :<<, :add, :close, :datetime_format, :datetime_format=, :debug, :debug?, :error, :error?, :fatal, :fatal?, :info, :info?, :log, :unknown, :warn, :warn?, # to logger, allowing nil to: :logger, allow_nil: true def logger @@logger if defined?(@@logger) end def use(value) return use_file(value) if value.kind_of?( ::Logger ) || value.kind_of?(String) end def info_with_elapsed(message=nil, &block) timer = Time.now result = block.call info("#{message} (#{timer.elapsed.microseconds}ms)") result end protected def use_file(file) # convert string to logger file = ::Logger.new(file) if file.kind_of?(String) # assign Logger @@logger = file end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
quandl_logger-0.2.1 | lib/quandl/logger.rb |
quandl_logger-0.2.0 | lib/quandl/logger.rb |