--- logger.rb.orig 2011-01-16 03:33:40.464288002 -0800 +++ logger.rb 2011-01-16 03:59:01.245288002 -0800 @@ -124,11 +124,15 @@ # # 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!' } # @@ -374,6 +378,9 @@ # 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 Logger#progname= as well). @@ -472,6 +479,8 @@ case msg when ::String msg + when ::Array + msg[0] % msg[1..-1] when ::Exception "#{ msg.message } (#{ msg.class })\n" << (msg.backtrace || []).join("\n")