Class: Log4r::GDC

Inherits:
Monitor
  • Object
show all
Defined in:
lib/log4r-color/GDC.rb

Overview

See log4r-color/GDC.rb

Class Method Summary collapse

Class Method Details

.clearObject



18
19
20
# File 'lib/log4r-color/GDC.rb', line 18

def self.clear()
  Thread.main[GDCNAME] = ""
end

.getObject



22
23
24
25
26
27
28
29
# File 'lib/log4r-color/GDC.rb', line 22

def self.get()
  $globalGDCLock.synchronize do
	if ( Thread.main[GDCNAME] == nil ) then
	  Thread.main[GDCNAME] = $0
	end
  end
  return Thread.main[GDCNAME]
end

.set(a_name) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/log4r-color/GDC.rb', line 31

def self.set( a_name )
  if ( Thread.current != Thread.main ) then
	raise "Can only initialize Global Diagnostic Context from Thread.main" 
  end
  $globalGDCLock.synchronize do
	Thread.main[GDCNAME] = a_name
  end
end