Sha256: 5295845a70a5c2988c1ac4fd2f5eefb5db8a6314e0063e0486fdd551cbca1310

Contents?: true

Size: 799 Bytes

Versions: 6

Compression:

Stored size: 799 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, Zookeeper::Constants::ZOO_LOG_LEVEL_ERROR
    yield
  ensure
    ZK.logger.level = orig_level
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zk-1.4.2 spec/support/logging.rb
zk-1.4.1 spec/support/logging.rb
zk-1.4.0 spec/support/logging.rb
zk-1.3.1 spec/support/logging.rb
zk-1.3.0 spec/support/logging.rb
zk-1.2.0 spec/support/logging.rb