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
# 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::Request.logger = @@log
  end
end

.logObject



25
26
27
# File 'lib/netscaler/logging.rb', line 25

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

Instance Method Details

#logObject

Meant for mixing into other classes for simplified logging



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

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