class Log4r::NDC

See log4r/NDC.rb

Public Class Methods

check_thread_instance() click to toggle source
# File lib/log4r/NDC.rb, line 17
def self.check_thread_instance()
  if ( Thread.current[NDCNAME] == nil ) then
    Thread.current[NDCNAME] = Array.new
    Thread.current[NDCNAMEMAXDEPTH] = NDCDEFAULTMAXDEPTH
  end
end
clear() click to toggle source
# File lib/log4r/NDC.rb, line 24
def self.clear()
  self.check_thread_instance()
  Thread.current[NDCNAME].clear
end
clone_stack() click to toggle source
# File lib/log4r/NDC.rb, line 29
def self.clone_stack()
  self.check_thread_instance()
  return Thread.current[NDCNAME].clone
end
get() click to toggle source
# File lib/log4r/NDC.rb, line 51
def self.get()
  self.check_thread_instance
  return Thread.current[NDCNAME] * " "
end
get_depth() click to toggle source
# File lib/log4r/NDC.rb, line 34
def self.get_depth()
  self.check_thread_instance()
  return Thread.current[NDCNAME].length
end
inherit( a_stack ) click to toggle source
# File lib/log4r/NDC.rb, line 39
def self.inherit( a_stack )
  if ( a_stack.class == Array ) then
    if ( Thread.current[NDCNAME] != nil ) then
      Thread.current[NDCNAME].clear
      Thread.current[NDCNAME] = nil
    end
    Thread.current[NDCNAME] = a_stack
  else
    raise "Expecting Array in NDC.inherit"
  end
end
peek() click to toggle source
# File lib/log4r/NDC.rb, line 56
def self.peek()
  self.check_thread_instance()
  return Thread.current[NDCNAME].last
end
pop() click to toggle source
# File lib/log4r/NDC.rb, line 61
def self.pop()
  self.check_thread_instance()
  return Thread.current[NDCNAME].pop
end
push( value ) click to toggle source
# File lib/log4r/NDC.rb, line 66
def self.push( value )
  self.check_thread_instance()
  if ( Thread.current[NDCNAME].length < Thread.current[NDCNAMEMAXDEPTH] ) then
    Thread.current[NDCNAME].push( value )
  end
end
remove() click to toggle source
# File lib/log4r/NDC.rb, line 73
def self.remove()
  self.check_thread_instance()
  Thread.current[NDCNAME].clear
  Thread.current[NDCNAMEMAXDEPTH] = nil
  Thread.current[NDCNAME] = nil
end
set_max_depth( max_depth ) click to toggle source
# File lib/log4r/NDC.rb, line 80
def self.set_max_depth( max_depth )
  self.check_thread_instance()
  Thread.current[NDCNAMEMAXDEPTH] = max_depth
end