Class: Log4r::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/win32/autogui/logging.rb

Instance Method Summary collapse

Instance Method Details

#logfileString

Returns filename of the logfile.

Returns:

  • (String)

    filename of the logfile



27
28
29
# File 'lib/win32/autogui/logging.rb', line 27

def logfile
  @filename
end

#logfile=(fn) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/win32/autogui/logging.rb', line 31

def logfile=(fn)
  fn = nil if fn == ''
  if fn == nil
    remove(:logfile) if @filename
  else
    FileOutputter.new(:logfile, :filename => fn, :trunc => @trunc)
    Outputter[:logfile].formatter = Log4r::PatternFormatter.new(:pattern => "[%5l %d] %M [%t]")
    add(:logfile)
  end
  @filename = fn
end

#truncBoolean

Returns truncate logfile.

Returns:

  • (Boolean)

    truncate logfile



17
18
19
# File 'lib/win32/autogui/logging.rb', line 17

def trunc
  @trunc.nil? ? true : @trunc
end

#trunc=(value) ⇒ Object



21
22
23
24
# File 'lib/win32/autogui/logging.rb', line 21

def trunc=(value)
  raise "Setting trunc has no effect since logfile is already initialized" if @filename
  @trunc = value
end