Sha256: 1c95af9a5e224c650fa5576772eec78ff99267e9eb3b556eccdb85369eb6a197

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 Bytes

Contents

module ZK
#   LOG_FILE = File.open(File.join(ZK::ZK_ROOT, 'test.log'), 'a').tap { |f| f.sync = true }
  LOG_FILE = File.join(ZK::ZK_ROOT, 'test.log')
#   LOG_FILE = $stderr
end

# ZK.logger = ENV['TRAVIS'] ? Logger.new($stderr) : Logger.new(ZK::LOG_FILE)

ZK.logger = Logger.new(ZK::LOG_FILE).tap { |l| l.level = Logger::DEBUG }

# Zookeeper.logger = ZK.logger
# Zookeeper.set_debug_level(4)

ZK.logger.debug { "LOG OPEN" }

module SpecGlobalLogger
  def logger
    ZK.logger
  end

  # sets the log level to FATAL for the duration of the block
  def mute_logger
    orig_level, ZK.logger.level = ZK.logger.level, Logger::FATAL
    orig_zk_level, Zookeeper.debug_level = Zookeeper.debug_level, ZookeeperConstants::ZOO_LOG_LEVEL_ERROR
    yield
  ensure
    ZK.logger.level = orig_level
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zk-1.1.1 spec/support/logging.rb
zk-1.1.0 spec/support/logging.rb