Module: Zookeeper::Logger

Included in:
CZookeeper, ClientMethods, Common::QueueWithPipe, Continuation, ZookeeperBase
Defined in:
lib/zookeeper/logger.rb

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object


3
4
5
6
7
8
9
10
11
# File 'lib/zookeeper/logger.rb', line 3

def self.included(mod)
  return false if mod < self    # avoid infinite recursion
  mod.class_eval do 
    def self.logger
      ::Zookeeper.logger || ::Logging.logger[logger_name]
    end
  end
  mod.extend(self)
end

.set_defaultObject


13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/zookeeper/logger.rb', line 13

def self.set_default
  ::Logging.logger['Zookeeper'].tap do |ch_root|
    ::Logging.appenders.stderr.tap do |serr|
      serr.layout = ::Logging.layouts.pattern(
        :pattern => '%.1l, [%d] %c30.30{2}:  %m\n',
        :date_pattern => '%Y-%m-%d %H:%M:%S.%6N' 
      )

      ch_root.add_appenders(serr)
    end

    ch_root.level = ENV['ZOOKEEPER_DEBUG'] ? :debug : :off
  end
end