Sha256: 153d5b28a9eb4fd555133c943ca8dc2792b0d49b9532b2836609cde4aa011512
Contents?: true
Size: 910 Bytes
Versions: 33
Compression:
Stored size: 910 Bytes
Contents
module Zookeeper module Logger def self.wrapped_logger if defined?(@@wrapped_logger) @@wrapped_logger else @@wrapped_logger = ::Logger.new(STDERR).tap { |l| l.level = ::Logger::FATAL } end end def self.wrapped_logger=(log) @@wrapped_logger = log end # @private module ClassMethods def logger ::Zookeeper.logger || ForwardingLogger.for(::Zookeeper::Logger.wrapped_logger, _zk_logger_name) end end def self.included(base) # return false if base < self # avoid infinite recursion base.extend(ClassMethods) end private def log_realtime(what) logger.debug do t = Benchmark.realtime { yield } "#{what} took #{t} sec" end end def logger @logger ||= (::Zookeeper.logger || self.class.logger) end end # Logger end # Zookeeper
Version data entries
33 entries across 33 versions & 2 rubygems