Module: Netscaler::Logging

Included in:
BaseRequest, Transaction, VServer::Request
Defined in:
lib/netscaler/logging.rb

Overview

A convenient module for mixins that allow to share the logging configuration everywhere easily

Constant Summary collapse

@@log =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configure(debug) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/netscaler/logging.rb', line 12

def Logging.configure(debug)
  if @@log.nil?
    @@log = Log4r::Logger.new 'netscaler'
    @@log.outputters = Log4r::Outputter.stderr
    @@log.level = Log4r::WARN
    Log4r::Outputter.stderr.formatter = Log4r::PatternFormatter.new(:pattern => "[%l]   %M")
    
    @@log.level = debug ? Log4r::DEBUG : Log4r::INFO

    Savon.configure do |config|
      config.log = debug ? true : false
      config.log_level = :debug
      config.logger = @@log
      config.raise_errors = false
    end
  end
end

.logObject



30
31
32
# File 'lib/netscaler/logging.rb', line 30

def Logging.log
  @@log ||= Log4r::Logger.root
end

Instance Method Details

#logObject

Meant for mixing into other classes for simplified logging



35
36
37
# File 'lib/netscaler/logging.rb', line 35

def log
  @@log ||= Log4r::Logger.root
end