See log4r/NDC.rb
# 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
# File lib/log4r/NDC.rb, line 24 def self.clear() self.check_thread_instance() Thread.current[NDCNAME].clear end
# File lib/log4r/NDC.rb, line 29 def self.clone_stack() self.check_thread_instance() return Thread.current[NDCNAME].clone end
# File lib/log4r/NDC.rb, line 51 def self.get() self.check_thread_instance return Thread.current[NDCNAME] * " " end
# File lib/log4r/NDC.rb, line 34 def self.get_depth() self.check_thread_instance() return Thread.current[NDCNAME].length end
# 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
# File lib/log4r/NDC.rb, line 56 def self.peek() self.check_thread_instance() return Thread.current[NDCNAME].last end
# File lib/log4r/NDC.rb, line 61 def self.pop() self.check_thread_instance() return Thread.current[NDCNAME].pop end
# 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
# 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
# File lib/log4r/NDC.rb, line 80 def self.set_max_depth( max_depth ) self.check_thread_instance() Thread.current[NDCNAMEMAXDEPTH] = max_depth end