Project

General

Profile

Bug #3869 » logger.rb.patch

postmodern (Hal Brodigan), 01/16/2011 08:56 PM

View differences:

logger.rb 2011-01-16 03:59:01.245288002 -0800
#
# logger.error "Argument #{ @foo } mismatch."
#
# 3. With progname.
# 3. Message as a format string.
#
# logger.debug ["User-input: %p", input]
#
# 4. With progname.
#
# logger.info('initialize') { "Initializing..." }
#
# 4. With severity.
# 5. With severity.
#
# logger.add(Logger::FATAL) { 'Fatal error!' }
#
......
# logger.info "Waiting for input from user"
# # ...
# logger.info { "User typed #{input}" }
# # ...
# logger.info ["User input: %p", input]
# # ...
#
# You'll probably stick to the second form above, unless you want to provide a
# program name (which you can do with <tt>Logger#progname=</tt> as well).
......
case msg
when ::String
msg
when ::Array
msg[0] % msg[1..-1]
when ::Exception
"#{ msg.message } (#{ msg.class })\n" <<
(msg.backtrace || []).join("\n")
(2-2/2)