[フレーム]

Class: Logger::Formatter

Inherits:
Object show all
Defined in:
opal/stdlib/logger.rb

Constant Summary collapse

MESSAGE_FORMAT =
"%s, [%s] %5s -- %s: %s\n"
DATE_TIME_FORMAT =
'%Y-%m-%dT%H:%M:%S.%6N'

Instance Method Summary collapse

Instance Method Details

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

18
19
20
# File 'opal/stdlib/logger.rb', line 18
def call(severity, time, progname, msg)
 format(MESSAGE_FORMAT , severity.chr, time.strftime(DATE_TIME_FORMAT ), severity, progname, message_as_string(msg))
end

#message_as_string(msg) ⇒ Object

22
23
24
25
26
27
28
29
30
31
# File 'opal/stdlib/logger.rb', line 22
def message_as_string(msg)
 case msg
 when ::String 
 msg
 when ::Exception
 msg.full_message
 else
 msg.inspect
 end
end

AltStyle によって変換されたページ (->オリジナル) /