Class: RuGUI::LogSupport::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rugui/log_support.rb

Instance Method Summary collapse

Constructor Details

#initialize(classname = nil) ⇒ Formatter

Returns a new instance of Formatter.



29
30
31
# File 'lib/rugui/log_support.rb', line 29

def initialize(classname = nil)
  @classname = classname
end

Instance Method Details

#call(severity, timestamp, progname, msg) ⇒ Object



33
34
35
36
# File 'lib/rugui/log_support.rb', line 33

def call(severity, timestamp, progname, msg)
  timestamp = timestamp.strftime(RuGUI.configuration.logger[:format] || "%Y-%m-%d %H:%M:%S")
  "#{timestamp} (#{severity}) (#{@classname}) #{msg}\n"
end